Skip to content

Commit

Permalink
git-svn: Correctly handle root commits in mergeinfo ranges
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Haggerty authored and Eric Wong committed Jun 28, 2011
1 parent eabd73a commit 124b70a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion t/t9159-git-svn-no-parent-mergeinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" &&
Expand Down

0 comments on commit 124b70a

Please sign in to comment.