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 . "$TEST_DIRECTORY"/lib-rebase.sh
17 # set up two branches like this:
19 # A1 - B1 - D1 - E1 - F1
23 test_expect_success 'setup' '
27 git reset --hard B1 &&
39 test_expect_success 'squash F1 into D1' '
40 FAKE_LINES="1 squash 4 2 3" git rebase -i -p B1 &&
41 test "$(git rev-parse HEAD^2)" = "$(git rev-parse C1)" &&
42 test "$(git rev-parse HEAD~2)" = "$(git rev-parse B1)" &&
56 # And rebase G1..M1 onto E2
58 test_expect_success 'rebase two levels of merge' '
62 git checkout -b branch3 H1 &&
65 git checkout -b branch2 G1 &&
68 GIT_EDITOR=: git rebase -i -p E2 &&
69 test "$(git rev-parse HEAD~3)" = "$(git rev-parse E2)" &&
70 test "$(git rev-parse HEAD~2)" = "$(git rev-parse HEAD^2^2~2)" &&
71 test "$(git rev-parse HEAD^2^1^1)" = "$(git rev-parse HEAD^2^2^1)"