Skip to content

Commit 76c82f9

Browse files
committed
Merge git://bogomips.org/git-svn into maint
* git://bogomips.org/git-svn: git-svn: Correctly handle root commits in mergeinfo ranges git-svn: Disambiguate rev-list arguments to improve error message git-svn: Demonstrate a bug with root commits in mergeinfo ranges
2 parents f5cfd52 + 124b70a commit 76c82f9

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

git-svn.perl

Lines changed: 8 additions & 4 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;
@@ -3154,9 +3158,9 @@ sub check_cherry_pick {
31543158
my $parents = shift;
31553159
my @ranges = @_;
31563160
my %commits = map { $_ => 1 }
3157-
_rev_list("--no-merges", $tip, "--not", $base, @$parents);
3161+
_rev_list("--no-merges", $tip, "--not", $base, @$parents, "--");
31583162
for my $range ( @ranges ) {
3159-
delete @commits{_rev_list($range)};
3163+
delete @commits{_rev_list($range, "--")};
31603164
}
31613165
for my $commit (keys %commits) {
31623166
if (has_no_changes($commit)) {
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
test_description='git svn handling of root commits in merge ranges'
3+
. ./lib-git-svn.sh
4+
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" &&
9+
svn_cmd co "$svnrepo" tmp &&
10+
(
11+
cd tmp &&
12+
echo "r2" > trunk/file.txt &&
13+
svn_cmd commit -m "Modify file.txt on trunk" &&
14+
svn_cmd cp trunk@1 branches/a &&
15+
svn_cmd commit -m "Create branch a from trunk r1" &&
16+
svn_cmd propset svn:mergeinfo /trunk:1-2 branches/a &&
17+
svn_cmd commit -m "Fake merge of trunk r2 into branch a" &&
18+
mkdir branches/b &&
19+
echo "r5" > branches/b/file2.txt &&
20+
svn_cmd add branches/b &&
21+
svn_cmd commit -m "Create branch b from thin air" &&
22+
echo "r6" > branches/b/file2.txt &&
23+
svn_cmd commit -m "Modify file2.txt on branch b" &&
24+
svn_cmd cp branches/b@5 branches/c &&
25+
svn_cmd commit -m "Create branch c from branch b r5" &&
26+
svn_cmd propset svn:mergeinfo /branches/b:5-6 branches/c &&
27+
svn_cmd commit -m "Fake merge of branch b r6 into branch c"
28+
) &&
29+
git svn init -s "$svnrepo" &&
30+
git svn fetch
31+
'
32+
33+
test_done

0 commit comments

Comments
 (0)