Re: [PATCH 2/4] nmbug: Handle missing @upstream in is_unmerged
authorW. Trevor King <wking@tremily.us>
Wed, 16 Jul 2014 00:11:02 +0000 (17:11 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:03:41 +0000 (10:03 -0800)
8b/b892654a9994c63f385e01fe27671552838e35 [new file with mode: 0644]

diff --git a/8b/b892654a9994c63f385e01fe27671552838e35 b/8b/b892654a9994c63f385e01fe27671552838e35
new file mode 100644 (file)
index 0000000..4cb17c8
--- /dev/null
@@ -0,0 +1,146 @@
+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 70EDC431FC7\r
+       for <notmuch@notmuchmail.org>; Tue, 15 Jul 2014 17:11:09 -0700 (PDT)\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 2JpD7mST2wrY for <notmuch@notmuchmail.org>;\r
+       Tue, 15 Jul 2014 17:11:05 -0700 (PDT)\r
+Received: from qmta12.emeryville.ca.mail.comcast.net\r
+       (qmta12.emeryville.ca.mail.comcast.net [76.96.27.227])\r
+       by olra.theworths.org (Postfix) with ESMTP id B4D6C431FC0\r
+       for <notmuch@notmuchmail.org>; Tue, 15 Jul 2014 17:11:05 -0700 (PDT)\r
+Received: from omta07.emeryville.ca.mail.comcast.net ([76.96.30.59])\r
+       by qmta12.emeryville.ca.mail.comcast.net with comcast\r
+       id Smxo1o0051GXsuc01oB4w9; Wed, 16 Jul 2014 00:11:04 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+       by omta07.emeryville.ca.mail.comcast.net with comcast\r
+       id SoB21o00R152l3L8UoB3H1; Wed, 16 Jul 2014 00:11:04 +0000\r
+Received: by odin.tremily.us (Postfix, from userid 1000)\r
+       id 3B8BF12951C5; Tue, 15 Jul 2014 17:11:02 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin;\r
+       t=1405469462; bh=PGp8ctgL0TGrS2I3am+TsMBelbccihS46DT5p1LM13M=;\r
+       h=Date:From:To:Cc:Subject:References:In-Reply-To;\r
+       b=nhmTbObCyMUBftpY02HftNf0jN4suvkwL//TcEqZF5W94zBB9+wQw4fPoW4/n0F2A\r
+       zG2Vaa1L/DReOdvv5l7a3tlU9k+f8MncosBZHMi0FDz9SJirr+r+EDUZS63h+fUWQC\r
+       UlVawrf1489WIe4kqid4jm30bbAeU40JEaGQkhyc=\r
+Date: Tue, 15 Jul 2014 17:11:02 -0700\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: David Bremner <bremner@debian.org>\r
+Subject: Re: [PATCH 2/4] nmbug: Handle missing @upstream in is_unmerged\r
+Message-ID: <20140716001102.GG30232@odin>\r
+References: <cover.1404678709.git.wking@tremily.us>\r
+       <f96d39a63a505216141bd2daaf3a52e066713296.1404678709.git.wking@tremily.us>\r
+       <874myi89vu.fsf@maritornes.cs.unb.ca>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; micalg=pgp-sha1;\r
+       protocol="application/pgp-signature"; boundary="nqkreNcslJAfgyzk"\r
+Content-Disposition: inline\r
+In-Reply-To: <874myi89vu.fsf@maritornes.cs.unb.ca>\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=1405469464;\r
+       bh=cNe6mQ4E5JpwaiDkUtSzOR8af1KhWD04CGwBY5WJu/A=;\r
+       h=Received:Received:Received:Date:From:To:Subject:Message-ID:\r
+       MIME-Version:Content-Type;\r
+       b=HuXFxlt6Txk6nueR8Mum4c2fMywa2JDRcN4aAHsdVvxrAhbpeFdP+YdXIb8sSR7eP\r
+       wyqL5sRE6fZobt2Lmt4//gv/VeXOKYmjKKklqXxMNN66hp2wK/GNDXvCctExhDVXOP\r
+       TbNpUsQbRhdKMdh/qBXuq9k6uprmodBKepaACLmccgynpYkTEmRw7Lo2CX74iDUTje\r
+       mgBKjx+vGyyArUBXCLDM1BbHUu3EEzJovP2zCm+Q948KTsNmsUPJmfwx+0fEnpc/LR\r
+       IN0Ik/2SC1dmCw0XQf3kTDmQeHJfHVf389JAqsImb6S7aCMSYqm4S2MR65VAVIurs7\r
+       fk7GzDo+sYMcQ==\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: Wed, 16 Jul 2014 00:11:09 -0000\r
+\r
+\r
+--nqkreNcslJAfgyzk\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Tue, Jul 15, 2014 at 08:44:53PM -0300, David Bremner wrote:\r
+> W. Trevor King writes:\r
+> > -  my $fetch_head =3D git ('rev-parse', $commit);\r
+> > +  my ($fetch_head, $status) =3D git_with_status ('rev-parse', $commit);\r
+> > +  if ($status) {\r
+> > +    return 0;\r
+> > +  }\r
+>=20\r
+> Could there be other errors here, other than @{upstream} not\r
+> existing?  At first glance it seems like there is potential to hide\r
+> errors here.\r
+\r
+Possible errors that I can find:\r
+\r
+* fatal: Not a git repository: =E2=80=A6 (with a poor GIT_DIR config)\r
+* fatal: ambiguous argument =E2=80=A6 (with an invalid/missing revision nam=\r
+e)\r
+* fatal: No upstream configured for branch =E2=80=A6 (when\r
+  branch.<name>.remote or branch.<name>.merge aren't set)\r
+\r
+All of which return 128 as of Git v1.9.1.  We're only interested in\r
+the last.  I'm fine looking for =E2=80=9CNo upstream configured for branch=\r
+=E2=80=9D\r
+after we capture stderr with =E2=80=9Cnmbug: Catch stderr in is_unmerged=E2=\r
+=80=9D [1],\r
+but I don't expect the other two error cases to happen very often.  At\r
+least, I doubt you could get this far into do_status with a broken\r
+GIT_DIR, and we're hard-coding '@{upstream}' here.\r
+\r
+Cheers,\r
+Trevor\r
+\r
+[1]: id:d55cf02465c5f2d83f2dd0bc666831ee524b0fb7.1404678709.git.wking@tremi=\r
+ly.us\r
+     http://article.gmane.org/gmane.mail.notmuch.general/18627\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
+--nqkreNcslJAfgyzk\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
+iQIcBAEBAgAGBQJTxcMUAAoJEG8/JgBt8ol8mSYP/RXAhtEQ8KdL7nqo/Q2VpNhQ\r
+s7wxanlzA4TmQ9ABQAtp5HlmpOo+4znMB8pD3DleHUDVIEIvCTjKdPVMI1ip4Ig3\r
+UfUoRwniFZcIGoR/wwtTi7im+9BQHIdvwj/mUpYM8iqGPOijEbPuWvtENJv9enOa\r
+XIcI4RDLFwqwmXjyz0pP4jvO63ZuVUkywZXhEnpljSezLCIwMOG9+EhUHQM+Q4lM\r
+MDRaVmq3ORFYKsOuhXFitTBP1CNjx0YOYkOHdRfTeNqDVnXkqIjnfMf/iIP9KKql\r
+bSyCkbqRtvbRtR1IomSETCSOr6G7z9huhFKfirIXdY0mS849UW4l8pggFtMjRF3G\r
+9QNMRyI1hIoIl6k8GBEhRAN0yWNEyhStha/16ZUIBJZ/bYo1xpOsKiSLhSVv7o7Q\r
+N0zqbNzwAiYWJBTtYjKYfK2o65nTJQ2DhqkSNkbue1WGXhqXXQpkFFXBbNEzQQlk\r
+6q8fr47CMyDVldOh5719pKcu2Fm+05VgbYlPLq2rr3dFxTBBDsQ+KFdWtVl/vx8B\r
+VqXkpnPUi8/ppMTXvIZBxXLpdCRyMX2ZYjJvs4RA/JYmIbPGdfBObExez1UH7e1Y\r
+cNjoXSD5/3GyRnVsDC4dfXmGb6FpemmWA3E68NESuEDsSrwDJndKhfR28cL7T+ve\r
+SecxTNpwbcdMYtPeztDz\r
+=9aiG\r
+-----END PGP SIGNATURE-----\r
+\r
+--nqkreNcslJAfgyzk--\r