| # Copyright (c) 2008 Stephen Haberman |
| test_description='git rebase preserve merges |
| This test runs git rebase with -p and tries to squash a commit from after |
| a merge to before the merge. |
| . "$TEST_DIRECTORY"/lib-rebase.sh |
| # set up two branches like this: |
| test_expect_success 'setup' ' |
| test_expect_success 'squash F1 into D1' ' |
| FAKE_LINES="1 squash 4 2 3" git rebase -i -p B1 && |
| test "$(git rev-parse HEAD^2)" = "$(git rev-parse C1)" && |
| test "$(git rev-parse HEAD~2)" = "$(git rev-parse B1)" && |
| # And rebase G1..M1 onto E2 |
| test_expect_success 'rebase two levels of merge' ' |
| git checkout -b branch3 H1 && |
| git checkout -b branch2 G1 && |
| GIT_EDITOR=: git rebase -i -p 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^1^1)" = "$(git rev-parse HEAD^2^2^1)" |