1
0
mirror of https://github.com/git/git.git synced 2024-09-28 18:32:37 +02:00

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>
This commit is contained in:
Michael Haggerty 2011-06-18 08:48:00 +02:00 committed by Eric Wong
parent eabd73a3b5
commit 124b70a2ad
2 changed files with 7 additions and 3 deletions

@ -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;

@ -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" &&