@@ -14,15 +14,20 @@ that the result still makes sense.
1414
1515set_fake_editor
1616
17- # set up two branches like this:
17+ # Set up the repository like this:
1818#
19- # A - B - C - D - E (master)
19+ # one - two - three - four (conflict-branch)
20+ # /
21+ # A - B - C - D - E (master)
22+ # | \
23+ # | F - G - H (branch1)
24+ # | \
25+ # \ I (branch2)
2026# \
21- # F - G - H (branch1)
22- # \
23- # I (branch2)
27+ # J - K - L - M (no-conflict-branch)
2428#
25- # where A, B, D and G touch the same file.
29+ # where A, B, D and G all touch file1, and one, two, three, four all
30+ # touch file "conflict".
2631
2732test_expect_success ' setup' '
2833 test_commit A file1 &&
@@ -36,9 +41,20 @@ test_expect_success 'setup' '
3641 test_commit H file5 &&
3742 git checkout -b branch2 F &&
3843 test_commit I file6
44+ git checkout -b conflict-branch A &&
45+ for n in one two three four
46+ do
47+ test_commit $n conflict
48+ done &&
49+ git checkout -b no-conflict-branch A &&
50+ for n in J K L M
51+ do
52+ test_commit $n file$n
53+ done
3954'
4055
4156test_expect_success ' no changes are a nop' '
57+ git checkout branch2 &&
4258 git rebase -i F &&
4359 test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
4460 test $(git rev-parse I) = $(git rev-parse HEAD)
@@ -97,7 +113,7 @@ cat > expect2 << EOF
97113D
98114=======
99115G
100- >>>>>>> 91201e5 ... G
116+ >>>>>>> 51047de ... G
101117EOF
102118
103119test_expect_success ' stop on conflicting pick' '
@@ -293,25 +309,15 @@ test_expect_success 'squash ignores blank lines' '
293309'
294310
295311test_expect_success ' squash works as expected' '
296- for n in one two three four
297- do
298- echo $n >> file$n &&
299- git add file$n &&
300- git commit -m $n
301- done &&
312+ git checkout -b squash-works no-conflict-branch &&
302313 one=$(git rev-parse HEAD~3) &&
303314 FAKE_LINES="1 squash 3 2" EXPECT_HEADER_COUNT=2 \
304315 git rebase -i HEAD~3 &&
305316 test $one = $(git rev-parse HEAD~2)
306317'
307318
308319test_expect_success ' interrupted squash works as expected' '
309- for n in one two three four
310- do
311- echo $n >> conflict &&
312- git add conflict &&
313- git commit -m $n
314- done &&
320+ git checkout -b interrupted-squash conflict-branch &&
315321 one=$(git rev-parse HEAD~3) &&
316322 (
317323 FAKE_LINES="1 squash 3 2" &&
@@ -328,12 +334,7 @@ test_expect_success 'interrupted squash works as expected' '
328334'
329335
330336test_expect_success ' interrupted squash works as expected (case 2)' '
331- for n in one two three four
332- do
333- echo $n >> conflict &&
334- git add conflict &&
335- git commit -m $n
336- done &&
337+ git checkout -b interrupted-squash2 conflict-branch &&
337338 one=$(git rev-parse HEAD~3) &&
338339 (
339340 FAKE_LINES="3 squash 1 2" &&
0 commit comments