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
This commit is contained in:
Junio C Hamano 2011-06-29 16:42:41 -07:00
commit 76c82f90ab
2 changed files with 41 additions and 4 deletions

View File

@ -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;
@ -3154,9 +3158,9 @@ sub check_cherry_pick {
my $parents = shift;
my @ranges = @_;
my %commits = map { $_ => 1 }
_rev_list("--no-merges", $tip, "--not", $base, @$parents);
_rev_list("--no-merges", $tip, "--not", $base, @$parents, "--");
for my $range ( @ranges ) {
delete @commits{_rev_list($range)};
delete @commits{_rev_list($range, "--")};
}
for my $commit (keys %commits) {
if (has_no_changes($commit)) {

View File

@ -0,0 +1,33 @@
#!/bin/sh
test_description='git svn handling of root commits in merge ranges'
. ./lib-git-svn.sh
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" &&
svn_cmd co "$svnrepo" tmp &&
(
cd tmp &&
echo "r2" > trunk/file.txt &&
svn_cmd commit -m "Modify file.txt on trunk" &&
svn_cmd cp trunk@1 branches/a &&
svn_cmd commit -m "Create branch a from trunk r1" &&
svn_cmd propset svn:mergeinfo /trunk:1-2 branches/a &&
svn_cmd commit -m "Fake merge of trunk r2 into branch a" &&
mkdir branches/b &&
echo "r5" > branches/b/file2.txt &&
svn_cmd add branches/b &&
svn_cmd commit -m "Create branch b from thin air" &&
echo "r6" > branches/b/file2.txt &&
svn_cmd commit -m "Modify file2.txt on branch b" &&
svn_cmd cp branches/b@5 branches/c &&
svn_cmd commit -m "Create branch c from branch b r5" &&
svn_cmd propset svn:mergeinfo /branches/b:5-6 branches/c &&
svn_cmd commit -m "Fake merge of branch b r6 into branch c"
) &&
git svn init -s "$svnrepo" &&
git svn fetch
'
test_done