diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2011-06-18 08:48:00 +0200 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-06-28 03:26:11 +0000 |
commit | 124b70a2adad2b2efdf50150a6840f1327d2f2cd (patch) | |
tree | d2b9f2f790084bb3624df84d26d28b8703dfcc2c | |
parent | git-svn: Disambiguate rev-list arguments to improve error message (diff) | |
download | tgif-124b70a2adad2b2efdf50150a6840f1327d2f2cd.tar.xz |
git-svn: Correctly handle root commits in mergeinfo ranges
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".
[ew: line-wrap at 80 columns]
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
-rwxr-xr-x | git-svn.perl | 8 | ||||
-rwxr-xr-x | t/t9159-git-svn-no-parent-mergeinfo.sh | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/git-svn.perl b/git-svn.perl index 1f1aa57109..89f83fd27a 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -3124,8 +3124,12 @@ 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 9472de3ab0..85120b70db 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" && |