Skip to content

Commit 124b70a

Browse files
mhaggerEric Wong
authored andcommitted
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 <[email protected]> Acked-by: Eric Wong <[email protected]>
1 parent eabd73a commit 124b70a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

git-svn.perl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3124,8 +3124,12 @@ sub lookup_svn_merge {
31243124
next;
31253125
}
31263126

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+
}
31293133

31303134
if ( !defined $tip or $top > $tip ) {
31313135
$tip = $top;

t/t9159-git-svn-no-parent-mergeinfo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
test_description='git svn handling of root commits in merge ranges'
33
. ./lib-git-svn.sh
44

5-
test_expect_failure 'test handling of root commits in merge ranges' '
5+
test_expect_success 'test handling of root commits in merge ranges' '
66
mkdir -p init/trunk init/branches init/tags &&
77
echo "r1" > init/trunk/file.txt &&
88
svn_cmd import -m "initial import" init "$svnrepo" &&

0 commit comments

Comments
 (0)