git-svn: handle merge-base failures
[gitweb.git] / git-svn.perl
index 947184afcfe2d9ac49c9bfc5c0fb0fa3538b83fa..e0773eff4ea3fa297925795e28e9b0dfdd0e35b6 100755 (executable)
@@ -3158,10 +3158,21 @@ sub find_extra_svn_parents {
                my $ranges = $ranges{$merge_tip};
 
                # check out 'new' tips
-               my $merge_base = command_oneline(
-                       "merge-base",
-                       @$parents, $merge_tip,
-                      );
+               my $merge_base;
+               eval {
+                       $merge_base = command_oneline(
+                               "merge-base",
+                               @$parents, $merge_tip,
+                       );
+               };
+               if ($@) {
+                       die "An error occurred during merge-base"
+                               unless $@->isa("Git::Error::Command");
+
+                       warn "W: Cannot find common ancestor between ".
+                            "@$parents and $merge_tip. Ignoring merge info.\n";
+                       next;
+               }
 
                # double check that there are no missing non-merge commits
                my (@incomplete) = check_cherry_pick(