--- /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 1251A431FBD\r
+ for <notmuch@notmuchmail.org>; Sat, 8 Mar 2014 08:26:41 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.1\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ RCVD_IN_DNSWL_NONE=-0.0001] 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 F6OI3rUsabkn for <notmuch@notmuchmail.org>;\r
+ Sat, 8 Mar 2014 08:26:37 -0800 (PST)\r
+Received: from qmta10.westchester.pa.mail.comcast.net\r
+ (qmta10.westchester.pa.mail.comcast.net [76.96.62.17])\r
+ by olra.theworths.org (Postfix) with ESMTP id 694E7431FB6\r
+ for <notmuch@notmuchmail.org>; Sat, 8 Mar 2014 08:26:37 -0800 (PST)\r
+Received: from omta22.westchester.pa.mail.comcast.net ([76.96.62.73])\r
+ by qmta10.westchester.pa.mail.comcast.net with comcast\r
+ id b3qX1n0031ap0As5A4Sd3F; Sat, 08 Mar 2014 16:26:37 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+ by omta22.westchester.pa.mail.comcast.net with comcast\r
+ id b4Sb1n00Q152l3L3i4Sc38; Sat, 08 Mar 2014 16:26:36 +0000\r
+Received: by odin.tremily.us (Postfix, from userid 1000)\r
+ id 046D6106C13B; Sat, 8 Mar 2014 08:26:33 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin;\r
+ t=1394295994; bh=nmXB2/JbhnASZIqNIrx31WEBxQcF10q7oRBIS+yChb8=;\r
+ h=Date:From:To:Cc:Subject:References:In-Reply-To;\r
+ b=n+ZRmQqgRk7A65jn3K1LAkbpBI6uh6o1eA9RGI+cb/3a9lixCI1F97c9VAoOvIbMB\r
+ dfQgRp26vuLNKh6sOTD3utORWHzWA9KibZqiwwVyXSM8xmKHEIMQHKcZ6DQyuvR0K3\r
+ P8AnN72M+SNjV3obivGyzQdFtyv4S6MCea9hDJl8=\r
+Date: Sat, 8 Mar 2014 08:26:33 -0800\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: David Bremner <david@tethera.net>\r
+Subject: Re: [PATCH] nmbug: Add 'clone' and replace FETCH_HEAD with\r
+ @{upstream}\r
+Message-ID: <20140308162633.GM16433@odin.tremily.us>\r
+References:\r
+ <80db13662a0313711ca3a91e338a63d35e64a83c.1391898002.git.wking@tremily.us>\r
+ <87siqsrhch.fsf@zancas.localnet>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; micalg=pgp-sha1;\r
+ protocol="application/pgp-signature"; boundary="dp9QYJgVRVEW2bsm"\r
+Content-Disposition: inline\r
+In-Reply-To: <87siqsrhch.fsf@zancas.localnet>\r
+OpenPGP: id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8;\r
+ url=http://tremily.us/pubkey.txt\r
+User-Agent: Mutt/1.5.22 (2013-10-16)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+ s=q20121106; t=1394295997;\r
+ bh=NqZRVi0pfJjp+0Bs8qtPjbOVzrMEm97OajCLGjXRrZ4=;\r
+ h=Received:Received:Received:Date:From:To:Subject:Message-ID:\r
+ MIME-Version:Content-Type;\r
+ b=BD8cdWuqViy+zrKveEYieurl9KmBfymSqVw1tbE7OhYMdw5HO47CYyGnsgCwmr9Ek\r
+ blcwXbjgEzG891fG5IhN3ArOEH3Vp7PCVg1m+pqkR/ymeJ75Ce0UIBou4ne/nXpeO6\r
+ pxMeeQvyHK3vJ11wqc74LEbxIczipRhgntuKmtZKaJwyYHugqYteMjO8gGoXLG8ANq\r
+ UZYgc3TN9s8mrsMWT/RW/+1DrXUU9KcvQ/uiLImJu1JupigBiXHUDhHLuS+YB/FLVF\r
+ qA6LGHBHQV29rK/8kk9YIS7kiFFvCa+uLGC53oxsy3Xyf/D1xW/QI/AYdORfjVHs73\r
+ Usc88vgM9LjZA==\r
+Cc: notmuch@notmuchmail.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: Sat, 08 Mar 2014 16:26:41 -0000\r
+\r
+\r
+--dp9QYJgVRVEW2bsm\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Sat, Mar 08, 2014 at 08:43:26AM -0400, David Bremner wrote:\r
+> W. Trevor King writes:\r
+> > +sub do_clone {\r
+> > + my $repository =3D shift;\r
+> > + system ('git', 'clone', '--bare', $repository, $NMBGIT) =3D=3D 0\r
+> > + or die "'git clone' exited with nonzero value\n";\r
+> > + my $branch =3D git ('symbolic-ref', 'HEAD');\r
+> > + $branch =3D~ s|^refs/heads/||;\r
+> > + git ('config', 'remote.origin.fetch', '+refs/heads/*:refs/remotes/or=\r
+igin/*');\r
+> > + git ('config', "branch.$branch.remote", 'origin');\r
+> > + git ('config', "branch.$branch.merge", 'refs/heads/$branch');\r
+> > + do_fetch();\r
+\r
+Oops, it looks like I used a tab instead of two spaces to indent\r
+do_fetch. I'll fix that in v2.\r
+\r
+> > +}\r
+>=20\r
+> I think doing a fetch immediately after a clone deserves a comment.\r
+\r
+I commented in the commit message. Basically everything from =E2=80=9COne\r
+tricky bit is that bare repositories don't set upstream tracking\r
+branches by default=E2=80=9D down through =E2=80=9Cgives us the master-bran=\r
+ch commit.=E2=80=9D\r
+is describing what's going on here, and why I made these changes.\r
+\r
+On the other hand, perhaps this is too many hoops to jump through to\r
+get upstreams without a working directory. As an alternative\r
+approach, we could drop --bare and use --no-checkout on the clone.\r
+That would also let us avoid the bare-recovery config adjustments and\r
+follow-up fetch. With do_clone reduced to just wrapping the 'git\r
+clone' command, we could remove it and just recommend folks run:\r
+\r
+ $ git clone --no-checkout http://nmbug.tethera.net/git/nmbug-tags.git ~/.=\r
+nmbug\r
+\r
+That's going to create ~/.nmbug/.git though, if we want to preserve\r
+the current bare-style ~/.nmbug/ layout, we'd need something like:\r
+\r
+ $ TEMPDIR=3D$(mktemp -d)\r
+ $ git clone --no-checkout --separate-git-dir=3D~/.nmbug \\r
+ > http://nmbug.tethera.net/git/nmbug-tags.git "${TEMPDIR}/nmbug"\r
+ $ rm -rf "${TEMPDIR}"\r
+\r
+If we go the --separate-git-dir route, I think we're better off hiding\r
+that in Perl ;).\r
+\r
+Of the three approaches:\r
+\r
+1. git clone --bare =E2=80=A6, tweak configs, and git fetch\r
+2. git clone --nocheckout =E2=80=A6\r
+3. git clone --nocheckout --separate-git-dir =E2=80=A6\r
+\r
+I prefer the third, but I'm happy with any of them.\r
+\r
+> > @@ -473,7 +487,7 @@ sub diff_index {\r
+> > sub diff_refs {\r
+> > my $filter =3D shift;\r
+> > my $ref1 =3D shift || 'HEAD';\r
+> > - my $ref2 =3D shift || 'FETCH_HEAD';\r
+> > + my $ref2 =3D shift || '@{upstream}';\r
+>=20\r
+> I wonder about hard-coding '@{upstream}' in several places. What do\r
+> you think about a global "constant"? OF course it was hard-coded\r
+> FETCH_HEAD before, but I think not in quite as many places.\r
+\r
+In the three non-comment places where I've hard-coded it, it's just a\r
+default in the case that the caller left that argument empty. In the\r
+two comment places where I've hard-coded it, one is just mentioning\r
+that it is the default, and the other is giving it as a useful\r
+example. I don't think that calls for another layer of indirection.\r
+\r
+Cheers,\r
+Trevor\r
+\r
+--=20\r
+This email may be signed or encrypted with GnuPG (http://www.gnupg.org).\r
+For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\r
+\r
+--dp9QYJgVRVEW2bsm\r
+Content-Type: application/pgp-signature; name="signature.asc"\r
+Content-Description: OpenPGP digital signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v2.0.22 (GNU/Linux)\r
+\r
+iQIcBAEBAgAGBQJTG0S3AAoJEKKfehoaNkbt4bYP/3vMIr+4d7pfdJzyfuz5Ezcp\r
+jiWeY6PD/O5XDIBxu4FfxsW7czMO/PZ1Om334M6VgmeE24Xl/y+a6FMf2f6FcQ7z\r
+/8g1vhzQJBo8iqcBJ72LPH+97suNK72tywEWt9Mzvyjwk5kl/ngn+zeD3fwCrBKD\r
+/4Z+cy42p84TkD69QJefOCAWeStHWIzJPFPPwxworY9rOigADklhoVsoZU55J1EM\r
+ySFsSW72N8wsf65qbjnuhwihOG9Hs6fcpHiqvgssEKwpEqtyvCO9Ide4YcqMfd17\r
+9i/iA4VqDaSEfFZqd4Yx3g192MCvft7g8AVQJw5VTWr9oodos2NYHeaNYdmPh+Y5\r
+gGqF/3YRPjXzFMyySljYjDO08jZrKMUHESAJ1SMbzDALnLgIA0+KMYkZBza7o05q\r
+/dkYpfBF1h4Zuj7cTHU/Cg/LmqpPtQiP4EPRkGa2Y7NnLcEb8jfdlHqpNx/PmFfG\r
+q3HAILQsJnGTg2I4s9wDRFuKIvEQL8uI0Ygl8LLS85wWN7f2nagNs9MExQs7otrs\r
+MFcAvN6m8SztBqAWRZ/ZkUx3LphQfhRy3qrnpHeT6wJQLfhXl7qhyTceadFBDvGQ\r
+Q8/tWV3q7tMtuwIQE7J9YtX2DbcQeT9Vf/NnaK2H0EMrSvr5eLNbvppe4WigqZ4P\r
+EXDgc9+5HWv1/35EFe4L\r
+=GZ0q\r
+-----END PGP SIGNATURE-----\r
+\r
+--dp9QYJgVRVEW2bsm--\r