chiark / gitweb /
is_fast_fwd simply returns false if no common history (pursuant to #720896)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 26 Aug 2013 15:35:58 +0000 (16:35 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 26 Aug 2013 15:35:58 +0000 (16:35 +0100)
dgit

diff --git a/dgit b/dgit
index a8077a8..f582be0 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -639,8 +639,14 @@ sub rev_parse ($) {
 
 sub is_fast_fwd ($$) {
     my ($ancestor,$child) = @_;
-    my $mb = cmdoutput @git, qw(merge-base), $ancestor, $child;
-    return rev_parse($mb) eq rev_parse($ancestor);
+    my @cmd = (@git, qw(merge-base), $ancestor, $child);
+    my $mb = cmdoutput_errok @cmd;
+    if (defined $mb) {
+       return rev_parse($mb) eq rev_parse($ancestor);
+    } else {
+       $?==256 or failedcmd @cmd;
+       return 0;
+    }
 }
 
 sub git_fetch_us () {