X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=devel%2Fnmbug%2Fnmbug;h=998ee6b4b0d083467617dff92c1eab78132ce2d3;hb=567aab405b05d9ef79ddf1b62302806b9ddbeaad;hp=d6f5213a08cf391ef3f43b3274dc87fce9eb905d;hpb=c20016742681e1ed48c83de32639e10507ffa14d;p=notmuch diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug index d6f5213a..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; } @@ -134,6 +141,7 @@ sub do_clone { $repository, $tempwork) == 0 or die "'git clone' exited with nonzero value\n"; git ('config', '--unset', 'core.worktree'); + git ('config', 'core.bare', 'true'); } sub is_committed { @@ -422,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);