@matheusbsbs / matheus-bagliano / commits / 6c4c44c458
Fork 0

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>

Michael Haggerty committed Jan 14, 2010 at 06:54 UTC 6c4c44c45881260877d7d9fd113fd75b74d7777c
1 file changed +26 -25
t/t3404-rebase-interactive.sh
+26 -25
@@ -14,15 +14,20 @@ that the result still makes sense.
14
15 set_fake_editor
16
17 -# set up two branches like this:
17 +# Set up the repository like this:
18 #
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)
26 # \
21 -# F - G - H (branch1)
22 -# \
23 -# I (branch2)
27 +# J - K - L - M (no-conflict-branch)
28 #
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".
31
32 test_expect_success 'setup' '
33 test_commit A file1 &&
@@ -36,9 +41,20 @@ test_expect_success 'setup' '
41 test_commit H file5 &&
42 git checkout -b branch2 F &&
43 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
54 '
55
56 test_expect_success 'no changes are a nop' '
57 + git checkout branch2 &&
58 git rebase -i F &&
59 test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
60 test $(git rev-parse I) = $(git rev-parse HEAD)
@@ -97,7 +113,7 @@ cat > expect2 << EOF
113 D
114 =======
115 G
100 ->>>>>>> 91201e5... G
116 +>>>>>>> 51047de... G
117 EOF
118
119 test_expect_success 'stop on conflicting pick' '
@@ -293,12 +309,7 @@ test_expect_success 'squash ignores blank lines' '
309 '
310
311 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 &&
313 one=$(git rev-parse HEAD~3) &&
314 FAKE_LINES="1 squash 3 2" EXPECT_HEADER_COUNT=2 \
315 git rebase -i HEAD~3 &&
@@ -306,12 +317,7 @@ test_expect_success 'squash works as expected' '
317 '
318
319 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 &&
321 one=$(git rev-parse HEAD~3) &&
322 (
323 FAKE_LINES="1 squash 3 2" &&
@@ -328,12 +334,7 @@ test_expect_success 'interrupted squash works as expected' '
334 '
335
336 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 &&
338 one=$(git rev-parse HEAD~3) &&
339 (
340 FAKE_LINES="3 squash 1 2" &&