[PATCH 2/2] git-svn: handle merge-base failures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change git-svn to warn and continue when merge-base fails while processing svn
merge tickets.

merge-base can fail when a partial branch is created and merged back to trunk
in svn, because it cannot find a common ancestor between the partial branch and
trunk.

Signed-off-by: Andrew Myrick <amyrick@xxxxxxxxx>
---
 git-svn.perl |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 8c7c034..d58982b 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -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(
-- 
1.6.6.2.g18c9a

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]