Skip to content

Commit 37e5c8f

Browse files
dschogitster
authored andcommitted
Simplify t3411
Use test_commit() and test_merge(). This way, it is harder to forget to tag, or to call test_tick before committing. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4bd03d1 commit 37e5c8f

File tree

1 file changed

+17
-48
lines changed

1 file changed

+17
-48
lines changed

t/t3411-rebase-preserve-around-merges.sh

Lines changed: 17 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,13 @@ set_fake_editor
2121
# -- C1 --
2222

2323
test_expect_success 'setup' '
24-
touch a &&
25-
touch b &&
26-
git add a &&
27-
git commit -m A1 &&
28-
git tag A1
29-
git add b &&
30-
git commit -m B1 &&
31-
git tag B1 &&
32-
git checkout -b branch &&
33-
touch c &&
34-
git add c &&
35-
git commit -m C1 &&
36-
git checkout master &&
37-
touch d &&
38-
git add d &&
39-
git commit -m D1 &&
40-
git merge branch &&
41-
touch f &&
42-
git add f &&
43-
git commit -m F1 &&
44-
git tag F1
24+
test_commit A1 &&
25+
test_commit B1 &&
26+
test_commit C1 &&
27+
git reset --hard B1 &&
28+
test_commit D1 &&
29+
test_merge E1 C1 &&
30+
test_commit F1
4531
'
4632

4733
# Should result in:
@@ -52,7 +38,7 @@ test_expect_success 'setup' '
5238
#
5339
test_expect_success 'squash F1 into D1' '
5440
FAKE_LINES="1 squash 3 2" git rebase -i -p B1 &&
55-
test "$(git rev-parse HEAD^2)" = "$(git rev-parse branch)" &&
41+
test "$(git rev-parse HEAD^2)" = "$(git rev-parse C1)" &&
5642
test "$(git rev-parse HEAD~2)" = "$(git rev-parse B1)" &&
5743
git tag E2
5844
'
@@ -70,32 +56,15 @@ test_expect_success 'squash F1 into D1' '
7056
# And rebase G1..M1 onto E2
7157

7258
test_expect_success 'rebase two levels of merge' '
73-
git checkout -b branch2 A1 &&
74-
touch g &&
75-
git add g &&
76-
git commit -m G1 &&
77-
git checkout -b branch3 &&
78-
touch h
79-
git add h &&
80-
git commit -m H1 &&
81-
git checkout -b branch4 &&
82-
touch i &&
83-
git add i &&
84-
git commit -m I1 &&
85-
git tag I1 &&
86-
git checkout branch3 &&
87-
touch j &&
88-
git add j &&
89-
git commit -m J1 &&
90-
git merge I1 --no-commit &&
91-
git commit -m K1 &&
92-
git tag K1 &&
93-
git checkout branch2 &&
94-
touch l &&
95-
git add l &&
96-
git commit -m L1 &&
97-
git merge K1 --no-commit &&
98-
git commit -m M1 &&
59+
test_commit G1 &&
60+
test_commit H1 &&
61+
test_commit I1 &&
62+
git checkout -b branch3 H1 &&
63+
test_commit J1 &&
64+
test_merge K1 I1 &&
65+
git checkout -b branch2 G1 &&
66+
test_commit L1 &&
67+
test_merge M1 K1 &&
9968
GIT_EDITOR=: git rebase -i -p E2 &&
10069
test "$(git rev-parse HEAD~3)" = "$(git rev-parse E2)" &&
10170
test "$(git rev-parse HEAD~2)" = "$(git rev-parse HEAD^2^2~2)" &&

0 commit comments

Comments
 (0)