3 # Copyright (c) 2008 Stephen Haberman
6 test_description
='git rebase preserve merges
8 This test runs git rebase with preserve merges and ensures commits
9 dropped by the --cherry-pick flag have their childrens parents
14 # set up two branches like this:
22 # where B, D and G touch the same file.
24 test_expect_success
'setup' '
25 test_commit A file1 &&
26 test_commit B file1 1 &&
27 test_commit C file2 &&
28 test_commit D file1 2 &&
29 test_commit E file3 &&
31 test_commit F file4 &&
32 test_commit G file1 3 &&
33 test_commit H file5 &&
40 # F - G - H -- L \ --> L
42 # I -- G2 -- J -- K I -- K
43 # G2 = same changes as G
44 test_expect_success
'skip same-resolution merges with -p' '
47 test_commit L file1 23 &&
49 test_commit G2 file1 3 &&
51 test_commit J file1 23 &&
52 test_commit K file7 file7 &&
54 test $(git rev-parse HEAD^^) = $(git rev-parse L) &&
55 test "23" = "$(cat file1)" &&
56 test "I" = "$(cat file6)" &&
57 test "file7" = "$(cat file7)"
62 # F - G - H -- L2 \ --> L2
64 # I -- G3 --- J2 -- K2 I -- G3 -- K2
65 # G2 = different changes as G
66 test_expect_success
'keep different-resolution merges with -p' '
69 test_commit L2 file1 23 &&
71 test_commit G3 file1 4 &&
73 test_commit J2 file1 24 &&
74 test_commit K2 file7 file7 &&
75 test_must_fail git rebase -i -p L2 &&
78 git rebase --continue &&
79 test $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&
80 test "234" = "$(cat file1)" &&
81 test "I" = "$(cat file6)" &&
82 test "file7" = "$(cat file7)"