[PATCH 2/4] nmbug: Handle missing @upstream in is_unmerged
authorW. Trevor King <wking@tremily.us>
Sun, 6 Jul 2014 20:40:20 +0000 (13:40 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:03:26 +0000 (10:03 -0800)
8b/c32d0b11e808ffa21c629da618308fc59adec6 [new file with mode: 0644]

diff --git a/8b/c32d0b11e808ffa21c629da618308fc59adec6 b/8b/c32d0b11e808ffa21c629da618308fc59adec6
new file mode 100644 (file)
index 0000000..0497c6e
--- /dev/null
@@ -0,0 +1,106 @@
+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 7EB01431FAF\r
+       for <notmuch@notmuchmail.org>; Sun,  6 Jul 2014 13:41:15 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, 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 TgKg9rJ1ab6w for <notmuch@notmuchmail.org>;\r
+       Sun,  6 Jul 2014 13:41:09 -0700 (PDT)\r
+Received: from qmta05.westchester.pa.mail.comcast.net\r
+       (qmta05.westchester.pa.mail.comcast.net [76.96.62.48])\r
+       by olra.theworths.org (Postfix) with ESMTP id 39AB4431FC3\r
+       for <notmuch@notmuchmail.org>; Sun,  6 Jul 2014 13:41:05 -0700 (PDT)\r
+Received: from omta07.westchester.pa.mail.comcast.net ([76.96.62.59])\r
+       by qmta05.westchester.pa.mail.comcast.net with comcast\r
+       id P8ac1o0031GhbT8558h2NN; Sun, 06 Jul 2014 20:41:02 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+       by omta07.westchester.pa.mail.comcast.net with comcast\r
+       id P8h01o00c152l3L3T8h1q8; Sun, 06 Jul 2014 20:41:02 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
+       by odin.tremily.us (Postfix) with ESMTPS id 6BAE812700E7;\r
+       Sun,  6 Jul 2014 13:41:00 -0700 (PDT)\r
+Received: (nullmailer pid 1911 invoked by uid 1000);\r
+       Sun, 06 Jul 2014 20:40:28 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/4] nmbug: Handle missing @upstream in is_unmerged\r
+Date: Sun,  6 Jul 2014 13:40:20 -0700\r
+Message-Id:\r
+ <f96d39a63a505216141bd2daaf3a52e066713296.1404678709.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.9.1.353.gc66d89d\r
+In-Reply-To: <cover.1404678709.git.wking@tremily.us>\r
+References: <cover.1404678709.git.wking@tremily.us>\r
+In-Reply-To: <cover.1404678709.git.wking@tremily.us>\r
+References: <cover.1404678709.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+       s=q20140121; t=1404679262;\r
+       bh=kmAt1x+8LgmwxUpoIKGCFxWxJj8pdO2KcEVrLC0x2mk=;\r
+       h=Received:Received:Received:Received:From:To:Subject:Date:\r
+       Message-Id;\r
+       b=hHsmtjdgoucnAwpYT1itRBijI+KNxP6LkbcOxPvyUhPw0gZEI0Uy8QdLvR6Stcimv\r
+       b1f/6KIJd5M+9epsE2BwvcjhbXCEouId2Dv93LTw6pIkWSqyvfUxNpGAR2eBIWS2XR\r
+       PLjysd1U6nuG29cGckQ8t0lkGk0DgehhNTSj8zb48hJWCMcueGpq29E5UuYGe7W3CL\r
+       vnP1ddza/VluaIT3IOxxVSXthxYJ7a5SSJSljGnYtMsjNxdPpJKbfSIF9SswqzJWxr\r
+       ICI0Moz5u+GBdM0Yt0VjAVg6dkUbgYzG+9lr0T/cM5WDPw4eBaQTnNVgaQ+YEAdAz2\r
+       PLsN6FumL3cQA==\r
+Cc: David Bremner <bremner@debian.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: Sun, 06 Jul 2014 20:41:15 -0000\r
+\r
+If we don't have an upstream, there is nothing to merge, so nothing is\r
+unmerged.  This avoids errors like:\r
+\r
+  $ nmbug status\r
+  error: No upstream configured for branch 'master'\r
+  error: No upstream configured for branch 'master'\r
+  fatal: ambiguous argument '@{upstream}': unknown revision or path not in the working tree.\r
+  Use '--' to separate paths from revisions, like this:\r
+  'git <command> [<revision>...] -- [<file>...]'\r
+  'git rev-parse @{upstream}' exited with nonzero value\r
+\r
+You might not have an upstream if you're only using nmbug locally to\r
+version-control your tags.\r
+---\r
+ devel/nmbug/nmbug | 5 ++++-\r
+ 1 file changed, 4 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug\r
+index 4a79722..998ee6b 100755\r
+--- a/devel/nmbug/nmbug\r
++++ b/devel/nmbug/nmbug\r
+@@ -430,7 +430,10 @@ sub do_status {\r
+ sub is_unmerged {\r
+   my $commit = shift || '@{upstream}';\r
\r
+-  my $fetch_head = git ('rev-parse', $commit);\r
++  my ($fetch_head, $status) = git_with_status ('rev-parse', $commit);\r
++  if ($status) {\r
++    return 0;\r
++  }\r
+   my $base = git ( 'merge-base', 'HEAD', $commit);\r
\r
+   return ($base ne $fetch_head);\r
+-- \r
+1.9.1.353.gc66d89d\r
+\r