aboutsummaryrefslogtreecommitdiffhomepage
path: root/devel/nmbug/nmbug
diff options
context:
space:
mode:
Diffstat (limited to 'devel/nmbug/nmbug')
-rwxr-xr-xdevel/nmbug/nmbug18
1 files changed, 14 insertions, 4 deletions
diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index b18ded7b..998ee6b4 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -63,13 +63,20 @@ sub git_pipe {
spawn ($envref, defined $ioref ? $ioref : (), defined $dir ? $dir : (), @_);
}
-sub git {
+sub git_with_status {
my $fh = git_pipe (@_);
my $str = join ('', <$fh>);
- unless (close $fh) {
+ close $fh;
+ my $status = $?;
+ chomp($str);
+ return ($str, $status);
+}
+
+sub git {
+ my ($str, $status) = git_with_status (@_);
+ if ($status) {
die "'git @_' exited with nonzero value\n";
}
- chomp($str);
return $str;
}
@@ -423,7 +430,10 @@ sub do_status {
sub is_unmerged {
my $commit = shift || '@{upstream}';
- my $fetch_head = git ('rev-parse', $commit);
+ my ($fetch_head, $status) = git_with_status ('rev-parse', $commit);
+ if ($status) {
+ return 0;
+ }
my $base = git ( 'merge-base', 'HEAD', $commit);
return ($base ne $fetch_head);