Skip to content

Commit

Permalink
t9151: Add two new svn:mergeinfo test cases
Browse files Browse the repository at this point in the history
When svn:mergeinfo contains two new parents in a specific order and
one is ancestor of the other, it is possible that git-svn discards the
wrong one. The first test case ("commit made to merged branch is
reachable from the merge") proves this.

The second test case ("merging two branches in one commit is detected
correctly") is just for completeness, since there was no test for
merging two (feature) branches to trunk in one commit.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
  • Loading branch information
Tuomas Suutari authored and Eric Wong committed Feb 26, 2010
1 parent ae5b370 commit 9560808
Show file tree
Hide file tree
Showing 3 changed files with 581 additions and 53 deletions.
15 changes: 15 additions & 0 deletions t/t9151-svn-mergeinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ test_expect_success 'svn non-merge merge commits did not become git merge commit
[ -z "$bad_non_merges" ]
'

test_expect_failure 'commit made to merged branch is reachable from the merge' '
before_commit=$(git rev-list --all --grep="trunk commit before merging trunk to b2")
merge_commit=$(git rev-list --all --grep="Merge trunk to b2")
not_reachable=$(git rev-list -1 $before_commit --not $merge_commit)
[ -z "$not_reachable" ]
'

test_expect_success 'merging two branches in one commit is detected correctly' '
f1_commit=$(git rev-list --all --grep="make f1 branch from trunk")
f2_commit=$(git rev-list --all --grep="make f2 branch from trunk")
merge_commit=$(git rev-list --all --grep="Merge f1 and f2 to trunk")
not_reachable=$(git rev-list -1 $f1_commit $f2_commit --not $merge_commit)
[ -z "$not_reachable" ]
'

test_expect_failure 'everything got merged in the end' '
unmerged=$(git rev-list --all --not master)
[ -z "$unmerged" ]
Expand Down
83 changes: 83 additions & 0 deletions t/t9151/make-svnmerge-dump
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,89 @@ svn merge ../branches/right --accept postpone
i=$(commit $i "non-merge right to trunk 2")
cd ..

say "Branching b1 from trunk"
svn update
svn cp trunk branches/b1
i=$(commit $i "make b1 branch from trunk")

say "Branching b2 from trunk"
svn update
svn cp trunk branches/b2
i=$(commit $i "make b2 branch from trunk")

say "Make a commit to b2"
svn update
cd branches/b2
echo "b2" > b2file
svn add b2file
i=$(commit $i "b2 update 1")
cd ../..

say "Make a commit to b1"
svn update
cd branches/b1
echo "b1" > b1file
svn add b1file
i=$(commit $i "b1 update 1")
cd ../..

say "Merge b1 to trunk"
svn update
cd trunk
svn merge ../branches/b1/ --accept postpone
i=$(commit $i "Merge b1 to trunk")
cd ..

say "Make a commit to trunk before merging trunk to b2"
svn update
cd trunk
echo "trunk" > trunkfile
svn add trunkfile
i=$(commit $i "trunk commit before merging trunk to b2")
cd ..

say "Merge trunk to b2"
svn update
cd branches/b2
svn merge ../../trunk/ --accept postpone
i=$(commit $i "Merge trunk to b2")
cd ../..

say "Merge b2 to trunk"
svn update
cd trunk
svn merge ../branches/b2/ --accept postpone
svn resolved b1file
svn resolved trunkfile
i=$(commit $i "Merge b2 to trunk")
cd ..

say "Creating f1 from trunk with a new file"
svn update
svn cp trunk branches/f1
cd branches/f1
echo "f1" > f1file
svn add f1file
cd ../..
i=$(commit $i "make f1 branch from trunk with a new file")

say "Creating f2 from trunk with a new file"
svn update
svn cp trunk branches/f2
cd branches/f2
echo "f2" > f2file
svn add f2file
cd ../..
i=$(commit $i "make f2 branch from trunk with a new file")

say "Merge f1 and f2 to trunk in one go"
svn update
cd trunk
svn merge ../branches/f1/ --accept postpone
svn merge ../branches/f2/ --accept postpone
i=$(commit $i "Merge f1 and f2 to trunk")
cd ..

say "Adding subdirectory to LEFT"
svn update
cd branches/left
Expand Down
Loading

0 comments on commit 9560808

Please sign in to comment.