--- /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 8F2C4431FAF\r
+ for <notmuch@notmuchmail.org>; Sun, 18 Jan 2015 16:40:23 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.338\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.338 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ DNS_FROM_AHBL_RHSBL=2.438, 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 jcyQCVynEcuw for <notmuch@notmuchmail.org>;\r
+ Sun, 18 Jan 2015 16:40:19 -0800 (PST)\r
+Received: from resqmta-po-10v.sys.comcast.net (resqmta-po-10v.sys.comcast.net\r
+ [96.114.154.169])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id D8A5B431FAE\r
+ for <notmuch@notmuchmail.org>; Sun, 18 Jan 2015 16:40:18 -0800 (PST)\r
+Received: from resomta-po-18v.sys.comcast.net ([96.114.154.242])\r
+ by resqmta-po-10v.sys.comcast.net with comcast\r
+ id hcfo1p0075E3ZMc01cgGbR; Mon, 19 Jan 2015 00:40:16 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+ by resomta-po-18v.sys.comcast.net with comcast\r
+ id hcgF1p00M152l3L01cgFya; Mon, 19 Jan 2015 00:40:16 +0000\r
+Received: by odin.tremily.us (Postfix, from userid 1000)\r
+ id F04D215A0222; Sun, 18 Jan 2015 16:40:14 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin;\r
+ t=1421628014; bh=tqAGPv0AIQtPv7JIH04q4Ykx3GdWkSagxJIjIDaaZTU=;\r
+ h=From:To:Cc:Subject:Date;\r
+ b=h8D3zjD73Bx59MGIllwx76S8JcoZKoT/mF/lIbw2prt+kbM/95K6uHGM6TQf+U1JP\r
+ xioztBJtTf62gb4V7YccW7+VRn2jaWJjuQ5apmYg4g91FTAIISxIMxOlIDnQxCtubp\r
+ 18DzlTbpJ1cUI/D40c0dmuyVr8xMOKmtFJ0OQQdY=\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4] nmbug: Add an 'init' command\r
+Date: Sun, 18 Jan 2015 16:40:10 -0800\r
+Message-Id:\r
+ <b3d22d1d587a626e91f536f6393e476a41de84c9.1421627321.git.wking@tremily.us>\r
+X-Mailer: git-send-email 2.0.4\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\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: Mon, 19 Jan 2015 00:40:23 -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\r
+'tags/...'\r
+ fatal: git-write-tree: error building trees\r
+ 'git HASH(0x9ef3eb8) write-tree' exited with nonzero value\r
+\r
+David Bremner suggested [1]:\r
+\r
+ $ git hash-object -w /dev/null\r
+\r
+instead of my Python version of:\r
+\r
+ $ git hash-object -w --stdin <&-\r
+\r
+but I expect that closing stdin is more portable than the /dev/null\r
+path (which doesn't exist on Windows, for example).\r
+\r
+The --bare init and use of NMBGIT as the work tree (what could go\r
+wrong with an empty commit?) are suggestions from Michal Sojka [2].\r
+\r
+[1]: id:87y4vu6uvf.fsf@maritornes.cs.unb.ca\r
+ http://thread.gmane.org/gmane.mail.notmuch.general/18626/focus=18720\r
+[2]: id:87a93a5or2.fsf@resox.2x.cz\r
+ http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=19767\r
+---\r
+Since v3 [1] I've incorporated Michal's suggestions [2]:\r
+\r
+* Start with 'git --git-dir {NMBGIT} init --bare\r
+* Use NMBGIT instead of a temporary workdir when creating the initial\r
+ “Start a new nmbug repository” commit.\r
+\r
+As well as the core.logallrefupdates tweak I turned up in testing [3].\r
+\r
+[1]: id:113512958b3fd64902517c1c55576faef816f852.1414532174.git.wking@tremily.us\r
+ http://thread.gmane.org/gmane.mail.notmuch.general/19495\r
+[2]: id:87a93a5or2.fsf@resox.2x.cz\r
+ http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=19767\r
+[3]: id:20141129201829.GI4062@odin.tremily.us\r
+ http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=19774\r
+\r
+ devel/nmbug/nmbug | 20 ++++++++++++++++++++\r
+ 1 file changed, 20 insertions(+)\r
+\r
+diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug\r
+index 932ec12..1297345 100755\r
+--- a/devel/nmbug/nmbug\r
++++ b/devel/nmbug/nmbug\r
+@@ -374,6 +374,25 @@ def fetch(remote=None):\r
+ _git(args=args, wait=True)\r
+ \r
+ \r
++def init(remote=None):\r
++ """\r
++ Create an empty nmbug repository.\r
++\r
++ This wraps 'git init' with a few extra steps to support subsequent\r
++ status and commit commands.\r
++ """\r
++ _spawn(args=['git', '--git-dir', NMBGIT, 'init', '--bare'], wait=True)\r
++ _git(args=['config', 'core.logallrefupdates', 'true'], wait=True)\r
++ # create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)\r
++ _git(args=['hash-object', '-w', '--stdin'], input='', wait=True)\r
++ _git(\r
++ args=[\r
++ 'commit', '--allow-empty', '-m', 'Start a new nmbug repository'\r
++ ],\r
++ additional_env={'GIT_WORK_TREE': NMBGIT},\r
++ wait=True)\r
++\r
++\r
+ def checkout():\r
+ """\r
+ Update the notmuch database from Git.\r
+@@ -725,6 +744,7 @@ if __name__ == '__main__':\r
+ 'commit',\r
+ 'fetch',\r
+ 'help',\r
++ 'init',\r
+ 'log',\r
+ 'merge',\r
+ 'pull',\r
+-- \r
+2.1.0.60.g85f0837\r
+\r