3 # Copyright (c) 2008 Stephen Haberman
6 test_description
='git rebase preserve merges
8 This test runs git rebase with -p and tries to squash a commit from after
9 a merge to before the merge.
13 if ! test_have_prereq REBASE_P
; then
14 skip_all
='skipping git rebase -p tests, as asked for'
18 .
"$TEST_DIRECTORY"/lib-rebase.sh
22 # set up two branches like this:
24 # A1 - B1 - D1 - E1 - F1
28 test_expect_success
'setup' '
32 git reset --hard B1 &&
44 test_expect_success
'squash F1 into D1' '
45 FAKE_LINES="1 squash 4 2 3" git rebase -i -p B1 &&
46 test "$(git rev-parse HEAD^2)" = "$(git rev-parse C1)" &&
47 test "$(git rev-parse HEAD~2)" = "$(git rev-parse B1)" &&
61 # And rebase G1..M1 onto E2
63 test_expect_success
'rebase two levels of merge' '
68 git checkout -b branch3 H1 &&
71 git checkout -b branch2 G1 &&
74 GIT_EDITOR=: git rebase -i -p E2 &&
75 test "$(git rev-parse HEAD~3)" = "$(git rev-parse E2)" &&
76 test "$(git rev-parse HEAD~2)" = "$(git rev-parse HEAD^2^2~2)" &&
77 test "$(git rev-parse HEAD^2^1^1)" = "$(git rev-parse HEAD^2^2^1)"