Re: [PATCH 4/4] nmbug: Add an 'init' command

Subject: Re: [PATCH 4/4] nmbug: Add an 'init' command

Date: Tue, 15 Jul 2014 20:54:28 -0300

To: W. Trevor King, notmuch@notmuchmail.org

Cc:

From: David Bremner


"W. Trevor King" <wking@tremily.us> writes:

> +sub do_init {
> +  my $tempwork = tempdir ('/tmp/nmbug-init.XXXXXX', CLEANUP => 1);
> +  system ('git', 'init', '--separate-git-dir', $NMBGIT, $tempwork) == 0
> +    or die "'git init' exited with nonzero value\n";
> +  git ('config', '--unset', 'core.worktree');
> +  git ('config', 'core.bare', 'true');
> +  # create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)
> +  git ('hash-object', '-w', '--stdin');
> +  git ( { GIT_WORK_TREE => $tempwork }, 'commit', '--allow-empty',
> +        '-m', 'Start a new nmbug repository' );
> +}
> +


Shouldn't this empty blob already be created by the following line:

my $EMPTYBLOB = git (qw{hash-object -t blob /dev/null});

Or is the key point to write it into the database?  Anyway I like my
hack slightly better than yours ;).

d


 

Thread: