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>

Michael Haggerty committed Jun 18, 2011 at 08:48 UTC 124b70a2adad2b2efdf50150a6840f1327d2f2cd
2 files changed +7 -3
git-svn.perl
+6 -2
@@ -3124,8 +3124,12 @@ sub lookup_svn_merge {
3124 next;
3125 }
3126
3127 - push @merged_commit_ranges,
3128 - "$bottom_commit^..$top_commit";
3127 + if (scalar(command('rev-parse', "$bottom_commit^@"))) {
3128 + push @merged_commit_ranges,
3129 + "$bottom_commit^..$top_commit";
3130 + } else {
3131 + push @merged_commit_ranges, "$top_commit";
3132 + }
3133
3134 if ( !defined $tip or $top > $tip ) {
3135 $tip = $top;
t/t9159-git-svn-no-parent-mergeinfo.sh
+1 -1
@@ -2,7 +2,7 @@
2 test_description='git svn handling of root commits in merge ranges'
3 . ./lib-git-svn.sh
4
5 -test_expect_failure 'test handling of root commits in merge ranges' '
5 +test_expect_success 'test handling of root commits in merge ranges' '
6 mkdir -p init/trunk init/branches init/tags &&
7 echo "r1" > init/trunk/file.txt &&
8 svn_cmd import -m "initial import" init "$svnrepo" &&