--- /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 055F0431FAF\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 39ChE9zv4cvo 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 391EB431FBF\r
+ for <notmuch@notmuchmail.org>; Sun, 6 Jul 2014 13:41:05 -0700 (PDT)\r
+Received: from omta20.westchester.pa.mail.comcast.net ([76.96.62.71])\r
+ by qmta05.westchester.pa.mail.comcast.net with comcast\r
+ id P8DP1o0021YDfWL558h2NP; Sun, 06 Jul 2014 20:41:02 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+ by omta20.westchester.pa.mail.comcast.net with comcast\r
+ id P8h11o00C152l3L3g8h1uR; 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 03D6D12700E9;\r
+ Sun, 6 Jul 2014 13:41:01 -0700 (PDT)\r
+Received: (nullmailer pid 1919 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 3/4] nmbug: Catch stderr in is_unmerged\r
+Date: Sun, 6 Jul 2014 13:40:21 -0700\r
+Message-Id:\r
+ <d55cf02465c5f2d83f2dd0bc666831ee524b0fb7.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=lXcf0zWTcgH6bbxfJZoxTktKlJbNvM03i7CRd8nlNJE=;\r
+ h=Received:Received:Received:Received:From:To:Subject:Date:\r
+ Message-Id;\r
+ b=MVQVdq9Ip+WFirjgW/QRjiUmcP46ups4dcfp4Sta0pAMl9r5vE8Zd8q3qMl2dhlvl\r
+ +2LaBRjILpDTvaxMYPOZYO81mxw0SzLpMnPdQoKgZ3i+yiKNtfJfrD1mz7lJz2glBE\r
+ BwhcxmBoNyx0O3cnAs3o29D57cAr1JcL984Q0nDYvnyDmB6NnbgYz41xfdbLbJZOc8\r
+ TDhaEqCWBtkSkqGr34aUNQE5tA1yzd7srKclLJnEwrNzfqTmJOrVdsj5OMKX0x9LpJ\r
+ aIywRi9vePWJUzF0cRp8pe8En2DsRmRssZBAA1l3z8r3O7P+dEOTD6oiD4Vmuyxlfy\r
+ qNH/qbp8xikzA==\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
+Add a '-2|' dir for "execute the command and pipe both stdout and\r
+stderr to us". Use this to catch stderr from the rev-parse call in\r
+is_unmerged. We already check the status, so we don't want to confuse\r
+users with stuff like:\r
+\r
+ error: No upstream configured for branch 'master'\r
+\r
+on nmbug's stderr.\r
+---\r
+ devel/nmbug/nmbug | 14 +++++++++++---\r
+ 1 file changed, 11 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug\r
+index 998ee6b..c9ac046 100755\r
+--- a/devel/nmbug/nmbug\r
++++ b/devel/nmbug/nmbug\r
+@@ -56,7 +56,7 @@ my $EMPTYBLOB = git (qw{hash-object -t blob /dev/null});\r
+ sub git_pipe {\r
+ my $envref = (ref $_[0] eq 'HASH') ? shift : {};\r
+ my $ioref = (ref $_[0] eq 'ARRAY') ? shift : undef;\r
+- my $dir = ($_[0] eq '-|' or $_[0] eq '|-') ? shift : undef;\r
++ my $dir = ($_[0] eq '-|' or $_[0] eq '-2|' or $_[0] eq '|-') ? shift : undef;\r
+ \r
+ unshift @_, 'git';\r
+ $envref->{GIT_DIR} ||= $NMBGIT;\r
+@@ -83,10 +83,15 @@ sub git {\r
+ sub spawn {\r
+ my $envref = (ref $_[0] eq 'HASH') ? shift : {};\r
+ my $ioref = (ref $_[0] eq 'ARRAY') ? shift : undef;\r
+- my $dir = ($_[0] eq '-|' or $_[0] eq '|-') ? shift : '-|';\r
++ my $dir = ($_[0] eq '-|' or $_[0] eq '-2|' or $_[0] eq '|-') ? shift : '-|';\r
++ my $stderr_to_stdout = $dir eq '-2|';\r
+ \r
+ die unless @_;\r
+ \r
++ if ($dir eq '-2|') {\r
++ $dir = '-|';\r
++ }\r
++\r
+ if (open my $child, $dir) {\r
+ return $child;\r
+ }\r
+@@ -105,6 +110,9 @@ sub spawn {\r
+ if ($dir ne '|-') {\r
+ open STDIN, '<', '/dev/null' or die "reopening stdin: $!"\r
+ }\r
++ if ($stderr_to_stdout) {\r
++ open(STDERR, ">&STDOUT");\r
++ }\r
+ exec @_;\r
+ die "exec @_: $!";\r
+ }\r
+@@ -430,7 +438,7 @@ sub do_status {\r
+ sub is_unmerged {\r
+ my $commit = shift || '@{upstream}';\r
+ \r
+- my ($fetch_head, $status) = git_with_status ('rev-parse', $commit);\r
++ my ($fetch_head, $status) = git_with_status ('-2|', 'rev-parse', $commit);\r
+ if ($status) {\r
+ return 0;\r
+ }\r
+-- \r
+1.9.1.353.gc66d89d\r
+\r