Skip to content

Commit 6c4c44c

Browse files
mhaggergitster
authored andcommitted
t3404: Set up more of the test repo in the "setup" step
...and reuse these pre-created branches in tests rather than creating duplicates. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent a25eb13 commit 6c4c44c

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

t/t3404-rebase-interactive.sh

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,20 @@ that the result still makes sense.
1414

1515
set_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

2732
test_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

4156
test_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
97113
D
98114
=======
99115
G
100-
>>>>>>> 91201e5... G
116+
>>>>>>> 51047de... G
101117
EOF
102118

103119
test_expect_success 'stop on conflicting pick' '
@@ -293,25 +309,15 @@ test_expect_success 'squash ignores blank lines' '
293309
'
294310

295311
test_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

308319
test_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

330336
test_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

Comments
 (0)