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

[PATCH 3/3] git-svn: Correctly handle root commits in mergeinfo ranges

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Jun 18, 2011, 06:48 UTC
Message-ID
<1308379680-17188-4-git-send-email-mhagger@alum.mit.edu>
In-Reply-To
<1308379680-17188-1-git-send-email-mhagger@alum.mit.edu>

If the bottom of a mergeinfo range is a commit that maps to a git root commit, then it doesn't have a parent. In such a case, use git commit range "$top_commit" rather than "$bottom_commit^..$top_commit".

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
 git-svn.perl                           |    7 +++++--
 t/t9159-git-svn-no-parent-mergeinfo.sh |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 2cc9242..7e121ae 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3111,8 +3111,11 @@ sub lookup_svn_merge {
 			next;
 		}
 
-		push @merged_commit_ranges,
-			"$bottom_commit^..$top_commit";
+		if (scalar(command('rev-parse', "$bottom_commit^@"))) {
+			push @merged_commit_ranges, "$bottom_commit^..$top_commit";
+		} else {
+			push @merged_commit_ranges, "$top_commit";
+		}
 
 		if ( !defined $tip or $top > $tip ) {
 			$tip = $top;
diff --git a/t/t9159-git-svn-no-parent-mergeinfo.sh b/t/t9159-git-svn-no-parent-mergeinfo.sh
index 9472de3..85120b7 100755
--- a/t/t9159-git-svn-no-parent-mergeinfo.sh
+++ b/t/t9159-git-svn-no-parent-mergeinfo.sh
@@ -2,7 +2,7 @@
 test_description='git svn handling of root commits in merge ranges'
 . ./lib-git-svn.sh
 
-test_expect_failure 'test handling of root commits in merge ranges' '
+test_expect_success 'test handling of root commits in merge ranges' '
 	mkdir -p init/trunk init/branches init/tags &&
 	echo "r1" > init/trunk/file.txt &&
 	svn_cmd import -m "initial import" init "$svnrepo" &&
-- 
1.7.5.4
Previous: Michael HaggertyNext: Eric Wong
Message 4 of 5 in “git-svn: Handle git root commits in mergeinfo ranges”
  1. 0/3 git-svn: Handle git root commits in mergeinfo rangesMichael Haggerty, Jun 18, 2011
  2. 1/3 git-svn: Demonstrate a bug with root commits in mergeinfo rangesMichael Haggerty, Jun 18, 2011
  3. 2/3 git-svn: Disambiguate rev-list arguments to improve error messageMichael Haggerty, Jun 18, 2011
  4. 3/3 git-svn: Correctly handle root commits in mergeinfo rangesMichael Haggerty, Jun 18, 2011
  5. Eric WongJun 28, 2011

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.