Re: [PATCH v4] nmbug: Add an 'init' command
authorW. Trevor King <wking@tremily.us>
Mon, 19 Jan 2015 16:55:35 +0000 (08:55 +1600)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:47:37 +0000 (14:47 -0700)
99/bca8c1a6aa6db5302b701a5ec338b5c17fd7c6 [new file with mode: 0644]

diff --git a/99/bca8c1a6aa6db5302b701a5ec338b5c17fd7c6 b/99/bca8c1a6aa6db5302b701a5ec338b5c17fd7c6
new file mode 100644 (file)
index 0000000..474d71d
--- /dev/null
@@ -0,0 +1,188 @@
+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 AEC50431FC0\r
+       for <notmuch@notmuchmail.org>; Mon, 19 Jan 2015 09:05:10 -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 JZVPe7DENam6 for <notmuch@notmuchmail.org>;\r
+       Mon, 19 Jan 2015 09:05:07 -0800 (PST)\r
+Received: from resqmta-po-04v.sys.comcast.net (resqmta-po-04v.sys.comcast.net\r
+       [96.114.154.163])\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 21F6E431FBF\r
+       for <notmuch@notmuchmail.org>; Mon, 19 Jan 2015 09:05:07 -0800 (PST)\r
+Received: from resomta-po-03v.sys.comcast.net ([96.114.154.227])\r
+       by resqmta-po-04v.sys.comcast.net with comcast\r
+       id ht471p0024ueUHc01t56fy; Mon, 19 Jan 2015 17:05:06 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+       by resomta-po-03v.sys.comcast.net with comcast\r
+       id ht541p00J152l3L01t54nz; Mon, 19 Jan 2015 17:05:06 +0000\r
+Received: by odin.tremily.us (Postfix, from userid 1000)\r
+       id 4BC6115A58EF; Mon, 19 Jan 2015 08:55:35 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin;\r
+       t=1421686535; bh=C5Q2AVtyAg9RB6yLQcaTUSoKDohQGTCMLbD4Wf0Y5+M=;\r
+       h=Date:From:To:Cc:Subject:References:In-Reply-To;\r
+       b=NwWMBuVEdrTOF+oRCRfgwCaLS9x4rHCZ0UeG9e99SiAMdkxf5gUgoTsdJDXCr37Br\r
+       DxyfujR2NFCyAjseUT4ah/Ov7mF/PkEd86EHzDdXuRtCXGcbAkqeSBjLbKM3zPZeno\r
+       sPDjOa1GtWuWUGYimHS1aII0TC3/mzsmA9Tik9QI=\r
+Date: Mon, 19 Jan 2015 08:55:35 -0800\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>\r
+Subject: Re: [PATCH v4] nmbug: Add an 'init' command\r
+Message-ID: <20150119165535.GR4613@odin.tremily.us>\r
+References:\r
+ <b3d22d1d587a626e91f536f6393e476a41de84c9.1421627321.git.wking@tremily.us>\r
+       <m2oapvf6kv.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; micalg=pgp-sha1;\r
+       protocol="application/pgp-signature"; boundary="phbq2bkSb+hZnunM"\r
+Content-Disposition: inline\r
+In-Reply-To: <m2oapvf6kv.fsf@guru.guru-group.fi>\r
+OpenPGP: id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8;\r
+       url=http://tremily.us/pubkey.txt\r
+User-Agent: Mutt/1.5.23 (2014-03-12)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+       s=q20140121; t=1421687106;\r
+       bh=YcmPdqO+XiYFwmyUmLiQJAPZfc5QlP3XfUK3VioIFGM=;\r
+       h=Received:Received:Received:Date:From:To:Subject:Message-ID:\r
+       MIME-Version:Content-Type;\r
+       b=EP8wGdk9JL1dje+6OPmVGHJAdlfvslJMN3gBhEtNPhCOZjzzRzauzelz9rdbFhV8B\r
+       cndDbhEcHNqRRezaqFZiEL2gtliARdb5Vo1oYYhFPiiXH0LjBaY7PuYbe+iX7ft9XU\r
+       05eCpMW6a6psrVoIVXN7RbUEaBwArqYVXHrJHhpQSIncwZxXJsun30rlpDiC4xCkl3\r
+       wXGT3U0m+w8zqcBqox9Tg6NXpFabehAOWcUuS2Yb2V0B53vxv60Z+a2ebn+CzDNgha\r
+       7oRPSI1GW81SZA1hfX0e014NzCNvcl55YcsuKZHKhMr7nS3ti5FVAU5L4yDhauapuu\r
+       lw8wWMBDNMN4Q==\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: Mon, 19 Jan 2015 17:05:10 -0000\r
+\r
+\r
+--phbq2bkSb+hZnunM\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Mon, Jan 19, 2015 at 11:44:16AM +0200, Tomi Ollila wrote:\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
+>=20\r
+> This is due to my default /path/to/git-templates/pre-commit\r
+> forbidding commits unless I've configured user.name & user.email for\r
+> that particular repository....\r
+>=20\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\r
+> be given to nmbug from command line...\r
+>=20\r
+> ... Ok, it was --no-verify and patching that to the command line\r
+> worked -- git complained that "Your name and email address were\r
+> configured automatically based on your username and hostname..."=E2=80=A6\r
+\r
+Hmm.  My initial feeling is that if your pre-commit hook doesn't want\r
+you to commit, we should respect that.  Although I'm not sure how to\r
+handle this case for folks like you that don't define a global\r
+username or email address.  Possibilities:\r
+\r
+* Drop the empty commit from =E2=80=98nmbug init=E2=80=99 and teach =E2=80=\r
+=98nmbug log=E2=80=99,\r
+  =E2=80=98status=E2=80=99, =E2=80=98commit=E2=80=99, etc. to handle the =\r
+=E2=80=9Cwe don't have any commits\r
+  yet=E2=80=9D case?  That gives you time between the init and first commit=\r
+ to\r
+  go into the repository and setup your username and email address by\r
+  hand.  This would be the most work, but gives us a more native\r
+  solution (=E2=80=98nmbug init=E2=80=99 maps more directly to =E2=80=98git=\r
+ init=E2=80=99).\r
+\r
+* Adjust the syntax to:\r
+\r
+    nmbug init -- {arguments passed through to =E2=80=98git commit=E2=80=99}\r
+\r
+  so you could run:\r
+\r
+    nmbug init -- --author 'A U Thor <author@example.com>'\r
+\r
+  or:\r
+\r
+    nmbug init -- --no-verify\r
+\r
+  this works as long as the tweak you need is accessible from a =E2=80=98git\r
+  commit=E2=80=99 argument (I guess --no-verify covers us there).\r
+\r
+> =E2=80=A6 but commit succeeded :).\r
+\r
+=46rom the template pre-commit.sample:\r
+\r
+  The hook should exit with non-zero status after issuing an\r
+  appropriate message if it wants to stop the commit.\r
+\r
+so you should check that your hook is doing that if you expect to\r
+abort commits it doesn't like ;).\r
+\r
+> I think it should be checked so that init on already-existing\r
+> repository does not succeed.\r
+\r
+Good point.  I've added:\r
+\r
+  if _os.path.exists(NMBGIT):\r
+      raise ValueError('NMBGIT path ({!r}) already exists'.format(NMBGIT))\r
+\r
+for v5.\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
+--phbq2bkSb+hZnunM\r
+Content-Type: application/pgp-signature; name="signature.asc"\r
+Content-Description: OpenPGP digital signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v2\r
+\r
+iQIcBAEBAgAGBQJUvTcFAAoJEG8/JgBt8ol8nwMP/RgEvEO7EnDq1/CjsOjWvN+8\r
+DzTPD3UIbahyytZr/wV+96rTO/z8X2Uj3GW3imSP3Moz9UP+v9tbzebRmwqFA+Nn\r
+o8cA4meUGdlfIl8+2DwDKKh9brntHabVrhmub8Yz10b4zlRXuNP1YOkOE2v1MRxI\r
+6w6DLQHPBuqWz79DnSl1x9ENfZ0f2lTey7nPbwnQ1KvnbcQKmDIMftX3V96bxUQ2\r
+8UJRCFIGoshOeZLUaf27czxP7gguV6vmKlRDPNl98VqEG6oYAkDZ5xxNfM2Nxqan\r
+ZfzJA6vMTmuaAW9y8ReVlKyqaLUz2mEznR8a6uxIBKAc8561r3GfzXE+ggzaG1eq\r
+rzDEzzPtsCZ8iaik0mFP8HZ/lmsXI4eQG2/TtoRB8qx/wfEwDZUaUSS+00MQJaC2\r
+1AjEeQ9Om+Onm1xFp8lFbZ5fjd1NbUDEBemgzol7vSueC0qM0pQWEP3cIAzTTafy\r
+xeb/HxdCduRvp/cy+yjDPgUWyWGGGBIxqKkSD+REBKKBGBUKHfjbDjknusLqYgdD\r
+snpQGA/Ic1RL40OTXaF2toxDlUeycXOl0ggI1CX0DW9eFfMDHxdzY1OX0D/yQo+V\r
+ToNGZKp/4BdhxYm3Tja5k8e8c8BXns14TSCS5E1o/WFF8UHEaGrNO48MjEzPA2Cj\r
+No9YFjQX0kOnKvkjQ/TJ\r
+=C9ca\r
+-----END PGP SIGNATURE-----\r
+\r
+--phbq2bkSb+hZnunM--\r