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

David Bremner david at tethera.net
Tue Jul 15 16:54:28 PDT 2014


"W. Trevor King" <wking at 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


 


More information about the notmuch mailing list