--- /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 1F60B431FBC\r
+ for <notmuch@notmuchmail.org>; Tue, 28 Oct 2014 14:48:53 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 iVAmIUFyDb92 for <notmuch@notmuchmail.org>;\r
+ Tue, 28 Oct 2014 14:48:45 -0700 (PDT)\r
+X-Greylist: delayed 489 seconds by postgrey-1.32 at olra;\r
+ Tue, 28 Oct 2014 14:48:45 PDT\r
+Received: from resqmta-ch2-12v.sys.comcast.net\r
+ (resqmta-ch2-12v.sys.comcast.net [69.252.207.44])\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 9216D431FB6\r
+ for <notmuch@notmuchmail.org>; Tue, 28 Oct 2014 14:48:45 -0700 (PDT)\r
+Received: from resomta-ch2-14v.sys.comcast.net ([69.252.207.110])\r
+ by resqmta-ch2-12v.sys.comcast.net with comcast\r
+ id 8lfU1p0032PT3Qt01lgaQd; Tue, 28 Oct 2014 21:40:34 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+ by resomta-ch2-14v.sys.comcast.net with comcast\r
+ id 8lgZ1p00D152l3L01lgZgP; Tue, 28 Oct 2014 21:40:34 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.150])\r
+ by odin.tremily.us (Postfix) with ESMTPS id 20379143B66A;\r
+ Tue, 28 Oct 2014 14:40:33 -0700 (PDT)\r
+Received: (nullmailer pid 1649 invoked by uid 1000);\r
+ Tue, 28 Oct 2014 21:39:38 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3] nmbug: Add an 'init' command\r
+Date: Tue, 28 Oct 2014 14:39:37 -0700\r
+Message-Id:\r
+ <113512958b3fd64902517c1c55576faef816f852.1414532174.git.wking@tremily.us>\r
+X-Mailer: git-send-email 2.1.0.60.g85f0837\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+ s=q20140121; t=1414532434;\r
+ bh=+b4338FE6AR4rbuk0tiZed9tdCuvDYau4XsVIfQaSS8=;\r
+ h=Received:Received:Received:Received:From:To:Subject:Date:\r
+ Message-Id;\r
+ b=umb8KtLVK0aQXSX+N5ME3pVChcKAeRn4cX0RpdnWz+bVihv6NQNsQMbB047priOvT\r
+ gpbfdUHc6oT2h6qiF/0rxko65/3fXvRh0orVmt5/Zw5KqLgnbbXa0BIqF4QdhUS1PV\r
+ 1nVC9plpRRT71FysS8O0rmPxSuLIhYMeysaCgHZdc7oVRbuZFryw10yFh99RFoQpB8\r
+ qXKRWg3j6FLi5OuAhZXdsp0M6/Vzn7SIkdAxIpIySrP7jsk5BNzbgfMAqm0i5JuYPD\r
+ PYkXcJI3EyjeTzfIZerlsZqeA4Cpj1tzAlWNm5+8rxH6eAkScFrqEW90WINOPOiWie\r
+ nAV6QShzoroow==\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: Tue, 28 Oct 2014 21:48:53 -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
+[1]: id:87y4vu6uvf.fsf@maritornes.cs.unb.ca\r
+ http://thread.gmane.org/gmane.mail.notmuch.general/18626/focus=18720\r
+---\r
+The only change since v2 [1] is a commit-message tweak:\r
+\r
+* Mention Windows as an OS with stdin but no /dev/null [2].\r
+\r
+Cheers,\r
+Trevor\r
+\r
+[1]: id:eaa9cf1cb3c00c591dc675c0f314ca31909ff74c.1412965476.git.wking@tremily.us\r
+ http://thread.gmane.org/gmane.mail.notmuch.general/19289\r
+[2]: id:20141011071000.GB10926@odin.tremily.us\r
+ http://article.gmane.org/gmane.mail.notmuch.general/19294\r
+\r
+ devel/nmbug/nmbug | 24 ++++++++++++++++++++++++\r
+ 1 file changed, 24 insertions(+)\r
+\r
+diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug\r
+index 9402ead..23bac5c 100755\r
+--- a/devel/nmbug/nmbug\r
++++ b/devel/nmbug/nmbug\r
+@@ -373,6 +373,29 @@ 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
++ with _tempfile.TemporaryDirectory(prefix='nmbug-init.') as workdir:\r
++ _spawn(\r
++ args=['git', 'init', '--separate-git-dir', NMBGIT, workdir],\r
++ wait=True)\r
++ _git(args=['config', '--unset', 'core.worktree'], wait=True)\r
++ _git(args=['config', 'core.bare', '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': workdir},\r
++ wait=True)\r
++\r
++\r
+ def checkout():\r
+ """\r
+ Update the notmuch database from Git.\r
+@@ -703,6 +726,7 @@ if __name__ == '__main__':\r
+ 'clone',\r
+ 'commit',\r
+ 'fetch',\r
++ 'init',\r
+ 'log',\r
+ 'merge',\r
+ 'pull',\r
+-- \r
+2.1.0.60.g85f0837\r
+\r