From ea8fa1112d2e22255ec2775cd411517e42fed3db Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 20 Jan 2015 08:55:35 +1600 Subject: [PATCH] Re: [PATCH v4] nmbug: Add an 'init' command --- 99/bca8c1a6aa6db5302b701a5ec338b5c17fd7c6 | 188 ++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 99/bca8c1a6aa6db5302b701a5ec338b5c17fd7c6 diff --git a/99/bca8c1a6aa6db5302b701a5ec338b5c17fd7c6 b/99/bca8c1a6aa6db5302b701a5ec338b5c17fd7c6 new file mode 100644 index 000000000..474d71df3 --- /dev/null +++ b/99/bca8c1a6aa6db5302b701a5ec338b5c17fd7c6 @@ -0,0 +1,188 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id AEC50431FC0 + for ; Mon, 19 Jan 2015 09:05:10 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 2.338 +X-Spam-Level: ** +X-Spam-Status: No, score=2.338 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_NONE=-0.0001] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id JZVPe7DENam6 for ; + Mon, 19 Jan 2015 09:05:07 -0800 (PST) +Received: from resqmta-po-04v.sys.comcast.net (resqmta-po-04v.sys.comcast.net + [96.114.154.163]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 21F6E431FBF + for ; Mon, 19 Jan 2015 09:05:07 -0800 (PST) +Received: from resomta-po-03v.sys.comcast.net ([96.114.154.227]) + by resqmta-po-04v.sys.comcast.net with comcast + id ht471p0024ueUHc01t56fy; Mon, 19 Jan 2015 17:05:06 +0000 +Received: from odin.tremily.us ([24.18.63.50]) + by resomta-po-03v.sys.comcast.net with comcast + id ht541p00J152l3L01t54nz; Mon, 19 Jan 2015 17:05:06 +0000 +Received: by odin.tremily.us (Postfix, from userid 1000) + id 4BC6115A58EF; Mon, 19 Jan 2015 08:55:35 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin; + t=1421686535; bh=C5Q2AVtyAg9RB6yLQcaTUSoKDohQGTCMLbD4Wf0Y5+M=; + h=Date:From:To:Cc:Subject:References:In-Reply-To; + b=NwWMBuVEdrTOF+oRCRfgwCaLS9x4rHCZ0UeG9e99SiAMdkxf5gUgoTsdJDXCr37Br + DxyfujR2NFCyAjseUT4ah/Ov7mF/PkEd86EHzDdXuRtCXGcbAkqeSBjLbKM3zPZeno + sPDjOa1GtWuWUGYimHS1aII0TC3/mzsmA9Tik9QI= +Date: Mon, 19 Jan 2015 08:55:35 -0800 +From: "W. Trevor King" +To: Tomi Ollila +Subject: Re: [PATCH v4] nmbug: Add an 'init' command +Message-ID: <20150119165535.GR4613@odin.tremily.us> +References: + + +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="phbq2bkSb+hZnunM" +Content-Disposition: inline +In-Reply-To: +OpenPGP: id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8; + url=http://tremily.us/pubkey.txt +User-Agent: Mutt/1.5.23 (2014-03-12) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; + s=q20140121; t=1421687106; + bh=YcmPdqO+XiYFwmyUmLiQJAPZfc5QlP3XfUK3VioIFGM=; + h=Received:Received:Received:Date:From:To:Subject:Message-ID: + MIME-Version:Content-Type; + b=EP8wGdk9JL1dje+6OPmVGHJAdlfvslJMN3gBhEtNPhCOZjzzRzauzelz9rdbFhV8B + cndDbhEcHNqRRezaqFZiEL2gtliARdb5Vo1oYYhFPiiXH0LjBaY7PuYbe+iX7ft9XU + 05eCpMW6a6psrVoIVXN7RbUEaBwArqYVXHrJHhpQSIncwZxXJsun30rlpDiC4xCkl3 + wXGT3U0m+w8zqcBqox9Tg6NXpFabehAOWcUuS2Yb2V0B53vxv60Z+a2ebn+CzDNgha + 7oRPSI1GW81SZA1hfX0e014NzCNvcl55YcsuKZHKhMr7nS3ti5FVAU5L4yDhauapuu + lw8wWMBDNMN4Q== +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 19 Jan 2015 17:05:10 -0000 + + +--phbq2bkSb+hZnunM +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +On Mon, Jan 19, 2015 at 11:44:16AM +0200, Tomi Ollila wrote: +> $ python2.7 devel/nmbug/nmbug init +> Reinitialized existing Git repository in /home/too/.nmbug/ +> e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 +> user.name not defined +> [u'git', u'--git-dir', u'/home/too/.nmbug', u'commit', u'--allow-empty', +> u'-m', u'Start a new nmbug repository'] exited with 1 +> zsh: exit 1 python2.7 devel/nmbug/nmbug init +>=20 +> This is due to my default /path/to/git-templates/pre-commit +> forbidding commits unless I've configured user.name & user.email for +> that particular repository.... +>=20 +> I guess there is not much one can do to handle users' mystic global +> hooks -- I'll look (later) whether e.g. '--no-hooks' parameter could +> be given to nmbug from command line... +>=20 +> ... Ok, it was --no-verify and patching that to the command line +> worked -- git complained that "Your name and email address were +> configured automatically based on your username and hostname..."=E2=80=A6 + +Hmm. My initial feeling is that if your pre-commit hook doesn't want +you to commit, we should respect that. Although I'm not sure how to +handle this case for folks like you that don't define a global +username or email address. Possibilities: + +* Drop the empty commit from =E2=80=98nmbug init=E2=80=99 and teach =E2=80= +=98nmbug log=E2=80=99, + =E2=80=98status=E2=80=99, =E2=80=98commit=E2=80=99, etc. to handle the = +=E2=80=9Cwe don't have any commits + yet=E2=80=9D case? That gives you time between the init and first commit= + to + go into the repository and setup your username and email address by + hand. This would be the most work, but gives us a more native + solution (=E2=80=98nmbug init=E2=80=99 maps more directly to =E2=80=98git= + init=E2=80=99). + +* Adjust the syntax to: + + nmbug init -- {arguments passed through to =E2=80=98git commit=E2=80=99} + + so you could run: + + nmbug init -- --author 'A U Thor ' + + or: + + nmbug init -- --no-verify + + this works as long as the tweak you need is accessible from a =E2=80=98git + commit=E2=80=99 argument (I guess --no-verify covers us there). + +> =E2=80=A6 but commit succeeded :). + +=46rom the template pre-commit.sample: + + The hook should exit with non-zero status after issuing an + appropriate message if it wants to stop the commit. + +so you should check that your hook is doing that if you expect to +abort commits it doesn't like ;). + +> I think it should be checked so that init on already-existing +> repository does not succeed. + +Good point. I've added: + + if _os.path.exists(NMBGIT): + raise ValueError('NMBGIT path ({!r}) already exists'.format(NMBGIT)) + +for v5. + +Cheers, +Trevor + +--=20 +This email may be signed or encrypted with GnuPG (http://www.gnupg.org). +For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy + +--phbq2bkSb+hZnunM +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2 + +iQIcBAEBAgAGBQJUvTcFAAoJEG8/JgBt8ol8nwMP/RgEvEO7EnDq1/CjsOjWvN+8 +DzTPD3UIbahyytZr/wV+96rTO/z8X2Uj3GW3imSP3Moz9UP+v9tbzebRmwqFA+Nn +o8cA4meUGdlfIl8+2DwDKKh9brntHabVrhmub8Yz10b4zlRXuNP1YOkOE2v1MRxI +6w6DLQHPBuqWz79DnSl1x9ENfZ0f2lTey7nPbwnQ1KvnbcQKmDIMftX3V96bxUQ2 +8UJRCFIGoshOeZLUaf27czxP7gguV6vmKlRDPNl98VqEG6oYAkDZ5xxNfM2Nxqan +ZfzJA6vMTmuaAW9y8ReVlKyqaLUz2mEznR8a6uxIBKAc8561r3GfzXE+ggzaG1eq +rzDEzzPtsCZ8iaik0mFP8HZ/lmsXI4eQG2/TtoRB8qx/wfEwDZUaUSS+00MQJaC2 +1AjEeQ9Om+Onm1xFp8lFbZ5fjd1NbUDEBemgzol7vSueC0qM0pQWEP3cIAzTTafy +xeb/HxdCduRvp/cy+yjDPgUWyWGGGBIxqKkSD+REBKKBGBUKHfjbDjknusLqYgdD +snpQGA/Ic1RL40OTXaF2toxDlUeycXOl0ggI1CX0DW9eFfMDHxdzY1OX0D/yQo+V +ToNGZKp/4BdhxYm3Tja5k8e8c8BXns14TSCS5E1o/WFF8UHEaGrNO48MjEzPA2Cj +No9YFjQX0kOnKvkjQ/TJ +=C9ca +-----END PGP SIGNATURE----- + +--phbq2bkSb+hZnunM-- -- 2.26.2