--- /dev/null
+Return-Path: <wking@tremily.us>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id C0F7B431FBD\r
+ for <notmuch@notmuchmail.org>; Sun, 6 Jul 2014 13:48:58 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id qBvRrPVHO24L for <notmuch@notmuchmail.org>;\r
+ Sun, 6 Jul 2014 13:48:52 -0700 (PDT)\r
+Received: from qmta15.westchester.pa.mail.comcast.net\r
+ (qmta15.westchester.pa.mail.comcast.net [76.96.59.228])\r
+ by olra.theworths.org (Postfix) with ESMTP id B23D0431FAF\r
+ for <notmuch@notmuchmail.org>; Sun, 6 Jul 2014 13:48:52 -0700 (PDT)\r
+Received: from omta13.westchester.pa.mail.comcast.net ([76.96.62.52])\r
+ by qmta15.westchester.pa.mail.comcast.net with comcast\r
+ id P8iR1o00117dt5G5F8osKw; Sun, 06 Jul 2014 20:48:52 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+ by omta13.westchester.pa.mail.comcast.net with comcast\r
+ id P8or1o001152l3L3Z8orwA; Sun, 06 Jul 2014 20:48:52 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
+ by odin.tremily.us (Postfix) with ESMTPS id 87A4612700EB;\r
+ Sun, 6 Jul 2014 13:41:01 -0700 (PDT)\r
+Received: (nullmailer pid 1926 invoked by uid 1000);\r
+ Sun, 06 Jul 2014 20:40:28 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 4/4] nmbug: Add an 'init' command\r
+Date: Sun, 6 Jul 2014 13:40:22 -0700\r
+Message-Id:\r
+ <05ccd672f55444f74da62250e2305fb84fdc6c42.1404678709.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.9.1.353.gc66d89d\r
+In-Reply-To: <cover.1404678709.git.wking@tremily.us>\r
+References: <cover.1404678709.git.wking@tremily.us>\r
+In-Reply-To: <cover.1404678709.git.wking@tremily.us>\r
+References: <cover.1404678709.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+ s=q20140121; t=1404679732;\r
+ bh=dn0RS2rWBoS7td+5aPxlmgggg5QBozIpMaUOv2R3px4=;\r
+ h=Received:Received:Received:Received:From:To:Subject:Date:\r
+ Message-Id;\r
+ b=PpE88UfamcI/+4wCrdmElSydAXGFEl1MP21FdDFa37EFs2Fnc3B+bXqA9suv5TMMd\r
+ BIcrdGfTk/0rgnIKySexA0IJ2f8+t0Ljm2GhwBZc6nRDm7vfoGAC3uBW3B9TMnSGcg\r
+ XUmQlIJ8jmZ0E6A0RMXV+bXd38DHvtJqdjmJaS2pIhPFi4I8msOy/UpLRav5pzZXJq\r
+ yuUF6lQrvHwTcXlYRVBftQrzYVUw+L3WDXARzw/CWmj28bGqsvJzVDypfR+EdMV0t9\r
+ WuUrSv61C4/e7yoZgcDAjzYDmmUto1tjiDQIcsbN6YHMmxj7ug/5zyGiIuC29sPB7M\r
+ 55fWgRWcOIy7A==\r
+Cc: David Bremner <bremner@debian.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 06 Jul 2014 20:48:58 -0000\r
+\r
+For folks that want to start versioning a new tag-space, instead of\r
+cloning one that someone else has already started.\r
+\r
+The empty-blob hash-object call avoids errors like:\r
+\r
+ $ nmbug commit\r
+ error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for 'tags/...'\r
+ fatal: git-write-tree: error building trees\r
+ 'git HASH(0x9ef3eb8) write-tree' exited with nonzero value\r
+---\r
+ devel/nmbug/nmbug | 19 +++++++++++++++++++\r
+ 1 file changed, 19 insertions(+)\r
+\r
+diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug\r
+index c9ac046..b64dab9 100755\r
+--- a/devel/nmbug/nmbug\r
++++ b/devel/nmbug/nmbug\r
+@@ -30,6 +30,7 @@ my %command = (\r
+ commit => \&do_commit,\r
+ fetch => \&do_fetch,\r
+ help => \&do_help,\r
++ init => \&do_init,\r
+ log => \&do_log,\r
+ merge => \&do_merge,\r
+ pull => \&do_pull,\r
+@@ -152,6 +153,18 @@ sub do_clone {\r
+ git ('config', 'core.bare', 'true');\r
+ }\r
+ \r
++sub do_init {\r
++ my $tempwork = tempdir ('/tmp/nmbug-init.XXXXXX', CLEANUP => 1);\r
++ system ('git', 'init', '--separate-git-dir', $NMBGIT, $tempwork) == 0\r
++ or die "'git init' exited with nonzero value\n";\r
++ git ('config', '--unset', 'core.worktree');\r
++ git ('config', 'core.bare', 'true');\r
++ # create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)\r
++ git ('hash-object', '-w', '--stdin');\r
++ git ( { GIT_WORK_TREE => $tempwork }, 'commit', '--allow-empty',\r
++ '-m', 'Start a new nmbug repository' );\r
++}\r
++\r
+ sub is_committed {\r
+ my $status = shift;\r
+ return scalar (@{$status->{added}} ) + scalar (@{$status->{deleted}} ) == 0;\r
+@@ -610,6 +623,12 @@ Create a local nmbug repository from a remote source. This wraps\r
+ C<git clone>, adding some options to avoid creating a working tree\r
+ while preserving remote-tracking branches and upstreams.\r
+ \r
++=item B<init>\r
++\r
++Create a local nmbug repository from scratch. This wraps C<git init>\r
++and performs other setup to support subsequent status and commit\r
++commands.\r
++\r
+ =item B<checkout>\r
+ \r
+ Update the notmuch database from git. This is mainly useful to discard\r
+-- \r
+1.9.1.353.gc66d89d\r
+\r