--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\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 991A3431FB6\r
+ for <notmuch@notmuchmail.org>; Mon, 19 Jan 2015 01:44:48 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.438\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
+ tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 4W8muZ0hLuck for <notmuch@notmuchmail.org>;\r
+ Mon, 19 Jan 2015 01:44:44 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 82E5F431FAF\r
+ for <notmuch@notmuchmail.org>; Mon, 19 Jan 2015 01:44:44 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 13C8F1000E0;\r
+ Mon, 19 Jan 2015 11:44:17 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: "W. Trevor King" <wking@tremily.us>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v4] nmbug: Add an 'init' command\r
+In-Reply-To:\r
+ <b3d22d1d587a626e91f536f6393e476a41de84c9.1421627321.git.wking@tremily.us>\r
+References:\r
+ <b3d22d1d587a626e91f536f6393e476a41de84c9.1421627321.git.wking@tremily.us>\r
+User-Agent: Notmuch/0.19+29~g7367d27 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Mon, 19 Jan 2015 11:44:16 +0200\r
+Message-ID: <m2oapvf6kv.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\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 09:44:48 -0000\r
+\r
+On Mon, Jan 19 2015, "W. Trevor King" <wking@tremily.us> wrote:\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 f=\r
+or\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
+I agree with this...\r
+\r
+I attempted to try this (being stup^H^H^H^Hadventurous and not backupping\r
+~/.nmbug -- should the existence be checked first ???) and got the followin=\r
+g ;/\r
+\r
+$ python2.7 devel/nmbug/nmbug init\r
+Reinitialized existing Git repository in /home/too/.nmbug/\r
+e69de29bb2d1d6434b8b29ae775ad8c2e48c5391\r
+user.name not defined\r
+[u'git', u'--git-dir', u'/home/too/.nmbug', u'commit', u'--allow-empty',\r
+u'-m', u'Start a new nmbug repository'] exited with 1\r
+zsh: exit 1 python2.7 devel/nmbug/nmbug init\r
+\r
+This is due to my default /path/to/git-templates/pre-commit forbidding\r
+commits unless I've configured user.name & user.email for that particular\r
+repository....\r
+\r
+I guess there is not much one can do to handle users' mystic global\r
+hooks -- I'll look (later) whether e.g. '--no-hooks' parameter could be giv=\r
+en\r
+to nmbug from command line...\r
+\r
+... Ok, it was --no-verify and patching that to the command line worked --\r
+git complained that "Your name and email address were configured\r
+automatically based on your username and hostname..." but commit succeeded =\r
+:).\r
+\r
+... but Now I issued nmbug init twice. now there are 2=20\r
+\r
+ Start a new nmbug repository\r
+\r
+commits. I think it should be checked so that init on already-existing\r
+repository does not succeed.\r
+\r
+\r
+Tomi\r
+\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=3D187=\r
+20\r
+> [2]: id:87a93a5or2.fsf@resox.2x.cz\r
+> http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=3D197=\r
+67\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
+> =E2=80=9CStart a new nmbug repository=E2=80=9D commit.\r
+>\r
+> As well as the core.logallrefupdates tweak I turned up in testing [3].\r
+>\r
+> [1]: id:113512958b3fd64902517c1c55576faef816f852.1414532174.git.wking@tre=\r
+mily.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=3D197=\r
+67\r
+> [3]: id:20141129201829.GI4062@odin.tremily.us\r
+> http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=3D197=\r
+74\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=3DNone):\r
+> _git(args=3Dargs, wait=3DTrue)\r
+>=20=20\r
+>=20=20\r
+> +def init(remote=3DNone):\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=3D['git', '--git-dir', NMBGIT, 'init', '--bare'], wait=\r
+=3DTrue)\r
+> + _git(args=3D['config', 'core.logallrefupdates', 'true'], wait=3DTrue)\r
+> + # create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)\r
+> + _git(args=3D['hash-object', '-w', '--stdin'], input=3D'', wait=3DTru=\r
+e)\r
+> + _git(\r
+> + args=3D[\r
+> + 'commit', '--allow-empty', '-m', 'Start a new nmbug reposito=\r
+ry'\r
+> + ],\r
+> + additional_env=3D{'GIT_WORK_TREE': NMBGIT},\r
+> + wait=3DTrue)\r
+> +\r
+> +\r
+> def checkout():\r
+> """\r
+> Update the notmuch database from Git.\r
+> @@ -725,6 +744,7 @@ if __name__ =3D=3D '__main__':\r
+> 'commit',\r
+> 'fetch',\r
+> 'help',\r
+> + 'init',\r
+> 'log',\r
+> 'merge',\r
+> 'pull',\r
+> --=20\r
+> 2.1.0.60.g85f0837\r