git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Andrew Myrick <amyrick@apple.com>
Date
Jan 6, 2010, 20:08 UTC
Message-ID
<1262808529-1575-2-git-send-email-amyrick@apple.com>
In-Reply-To
<1262808529-1575-1-git-send-email-amyrick@apple.com>

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@apple.com>
---
 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
Previous: Andrew MyrickNext: Eric Wong
Message 2 of 11 in “git-svn: ignore changeless commits when checking for a cherry-pick”
  1. 1/2 git-svn: ignore changeless commits when checking for a cherry-pickAndrew Myrick, Jan 6, 2010
  2. 2/2 git-svn: handle merge-base failuresAndrew Myrick, Jan 6, 2010
  3. Eric WongJan 6, 2010
  4. Sam VilainJan 6, 2010
  5. Eric WongJan 7, 2010
  6. Sam VilainJan 7, 2010
  7. Andrew MyrickJan 6, 2010
  8. 1/2 git-svn: ignore changeless commits when checking for a cherry-pickAndrew Myrick, Jan 7, 2010
  9. 2/2 git-svn: handle merge-base failuresAndrew Myrick, Jan 7, 2010
  10. Eric WongJan 7, 2010
  11. git-svn: update svn mergeinfo test suiteAndrew Myrick, Jan 21, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.