Skip to content

Commit 9560808

Browse files
suutariEric Wong
authored andcommitted
t9151: Add two new svn:mergeinfo test cases
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>
1 parent ae5b370 commit 9560808

File tree

3 files changed

+581
-53
lines changed

3 files changed

+581
-53
lines changed

t/t9151-svn-mergeinfo.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ test_expect_success 'svn non-merge merge commits did not become git merge commit
3333
[ -z "$bad_non_merges" ]
3434
'
3535

36+
test_expect_failure 'commit made to merged branch is reachable from the merge' '
37+
before_commit=$(git rev-list --all --grep="trunk commit before merging trunk to b2")
38+
merge_commit=$(git rev-list --all --grep="Merge trunk to b2")
39+
not_reachable=$(git rev-list -1 $before_commit --not $merge_commit)
40+
[ -z "$not_reachable" ]
41+
'
42+
43+
test_expect_success 'merging two branches in one commit is detected correctly' '
44+
f1_commit=$(git rev-list --all --grep="make f1 branch from trunk")
45+
f2_commit=$(git rev-list --all --grep="make f2 branch from trunk")
46+
merge_commit=$(git rev-list --all --grep="Merge f1 and f2 to trunk")
47+
not_reachable=$(git rev-list -1 $f1_commit $f2_commit --not $merge_commit)
48+
[ -z "$not_reachable" ]
49+
'
50+
3651
test_expect_failure 'everything got merged in the end' '
3752
unmerged=$(git rev-list --all --not master)
3853
[ -z "$unmerged" ]

t/t9151/make-svnmerge-dump

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,89 @@ svn merge ../branches/right --accept postpone
156156
i=$(commit $i "non-merge right to trunk 2")
157157
cd ..
158158

159+
say "Branching b1 from trunk"
160+
svn update
161+
svn cp trunk branches/b1
162+
i=$(commit $i "make b1 branch from trunk")
163+
164+
say "Branching b2 from trunk"
165+
svn update
166+
svn cp trunk branches/b2
167+
i=$(commit $i "make b2 branch from trunk")
168+
169+
say "Make a commit to b2"
170+
svn update
171+
cd branches/b2
172+
echo "b2" > b2file
173+
svn add b2file
174+
i=$(commit $i "b2 update 1")
175+
cd ../..
176+
177+
say "Make a commit to b1"
178+
svn update
179+
cd branches/b1
180+
echo "b1" > b1file
181+
svn add b1file
182+
i=$(commit $i "b1 update 1")
183+
cd ../..
184+
185+
say "Merge b1 to trunk"
186+
svn update
187+
cd trunk
188+
svn merge ../branches/b1/ --accept postpone
189+
i=$(commit $i "Merge b1 to trunk")
190+
cd ..
191+
192+
say "Make a commit to trunk before merging trunk to b2"
193+
svn update
194+
cd trunk
195+
echo "trunk" > trunkfile
196+
svn add trunkfile
197+
i=$(commit $i "trunk commit before merging trunk to b2")
198+
cd ..
199+
200+
say "Merge trunk to b2"
201+
svn update
202+
cd branches/b2
203+
svn merge ../../trunk/ --accept postpone
204+
i=$(commit $i "Merge trunk to b2")
205+
cd ../..
206+
207+
say "Merge b2 to trunk"
208+
svn update
209+
cd trunk
210+
svn merge ../branches/b2/ --accept postpone
211+
svn resolved b1file
212+
svn resolved trunkfile
213+
i=$(commit $i "Merge b2 to trunk")
214+
cd ..
215+
216+
say "Creating f1 from trunk with a new file"
217+
svn update
218+
svn cp trunk branches/f1
219+
cd branches/f1
220+
echo "f1" > f1file
221+
svn add f1file
222+
cd ../..
223+
i=$(commit $i "make f1 branch from trunk with a new file")
224+
225+
say "Creating f2 from trunk with a new file"
226+
svn update
227+
svn cp trunk branches/f2
228+
cd branches/f2
229+
echo "f2" > f2file
230+
svn add f2file
231+
cd ../..
232+
i=$(commit $i "make f2 branch from trunk with a new file")
233+
234+
say "Merge f1 and f2 to trunk in one go"
235+
svn update
236+
cd trunk
237+
svn merge ../branches/f1/ --accept postpone
238+
svn merge ../branches/f2/ --accept postpone
239+
i=$(commit $i "Merge f1 and f2 to trunk")
240+
cd ..
241+
159242
say "Adding subdirectory to LEFT"
160243
svn update
161244
cd branches/left

0 commit comments

Comments
 (0)