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 <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin 2009-01-27 23:35:05 +01:00 committed by Junio C Hamano
parent 4bd03d15e4
commit 37e5c8f460

View File

@ -21,27 +21,13 @@ set_fake_editor
# -- C1 -- # -- C1 --
test_expect_success 'setup' ' test_expect_success 'setup' '
touch a && test_commit A1 &&
touch b && test_commit B1 &&
git add a && test_commit C1 &&
git commit -m A1 && git reset --hard B1 &&
git tag A1 test_commit D1 &&
git add b && test_merge E1 C1 &&
git commit -m B1 && test_commit F1
git tag B1 &&
git checkout -b branch &&
touch c &&
git add c &&
git commit -m C1 &&
git checkout master &&
touch d &&
git add d &&
git commit -m D1 &&
git merge branch &&
touch f &&
git add f &&
git commit -m F1 &&
git tag F1
' '
# Should result in: # Should result in:
@ -52,7 +38,7 @@ test_expect_success 'setup' '
# #
test_expect_success 'squash F1 into D1' ' test_expect_success 'squash F1 into D1' '
FAKE_LINES="1 squash 3 2" git rebase -i -p B1 && FAKE_LINES="1 squash 3 2" git rebase -i -p B1 &&
test "$(git rev-parse HEAD^2)" = "$(git rev-parse branch)" && test "$(git rev-parse HEAD^2)" = "$(git rev-parse C1)" &&
test "$(git rev-parse HEAD~2)" = "$(git rev-parse B1)" && test "$(git rev-parse HEAD~2)" = "$(git rev-parse B1)" &&
git tag E2 git tag E2
' '
@ -70,32 +56,15 @@ test_expect_success 'squash F1 into D1' '
# And rebase G1..M1 onto E2 # And rebase G1..M1 onto E2
test_expect_success 'rebase two levels of merge' ' test_expect_success 'rebase two levels of merge' '
git checkout -b branch2 A1 && test_commit G1 &&
touch g && test_commit H1 &&
git add g && test_commit I1 &&
git commit -m G1 && git checkout -b branch3 H1 &&
git checkout -b branch3 && test_commit J1 &&
touch h test_merge K1 I1 &&
git add h && git checkout -b branch2 G1 &&
git commit -m H1 && test_commit L1 &&
git checkout -b branch4 && test_merge M1 K1 &&
touch i &&
git add i &&
git commit -m I1 &&
git tag I1 &&
git checkout branch3 &&
touch j &&
git add j &&
git commit -m J1 &&
git merge I1 --no-commit &&
git commit -m K1 &&
git tag K1 &&
git checkout branch2 &&
touch l &&
git add l &&
git commit -m L1 &&
git merge K1 --no-commit &&
git commit -m M1 &&
GIT_EDITOR=: git rebase -i -p E2 && GIT_EDITOR=: git rebase -i -p E2 &&
test "$(git rev-parse HEAD~3)" = "$(git rev-parse E2)" && test "$(git rev-parse HEAD~3)" = "$(git rev-parse E2)" &&
test "$(git rev-parse HEAD~2)" = "$(git rev-parse HEAD^2^2~2)" && test "$(git rev-parse HEAD~2)" = "$(git rev-parse HEAD^2^2~2)" &&