Git fork

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

+41 -4
+8 -4
git-svn.perl
··· 3124 3124 next; 3125 3125 } 3126 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 + } 3129 3133 3130 3134 if ( !defined $tip or $top > $tip ) { 3131 3135 $tip = $top; ··· 3154 3158 my $parents = shift; 3155 3159 my @ranges = @_; 3156 3160 my %commits = map { $_ => 1 } 3157 - _rev_list("--no-merges", $tip, "--not", $base, @$parents); 3161 + _rev_list("--no-merges", $tip, "--not", $base, @$parents, "--"); 3158 3162 for my $range ( @ranges ) { 3159 - delete @commits{_rev_list($range)}; 3163 + delete @commits{_rev_list($range, "--")}; 3160 3164 } 3161 3165 for my $commit (keys %commits) { 3162 3166 if (has_no_changes($commit)) {
+33
t/t9159-git-svn-no-parent-mergeinfo.sh
··· 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