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' '
32 git commit -m B file1 &&
39 git commit -m D file1 &&
45 git checkout -b branch1 A &&
53 git commit -m G file1 &&
60 git checkout -b branch2 F &&
70 # F - G - H -- L \ --> L
72 # I -- G2 -- J -- K I -- K
73 # G2 = same changes as G
74 test_expect_success
'skip same-resolution merges with -p' '
75 git checkout branch1 &&
80 git checkout branch2 &&
82 git commit -a -m G2 &&
90 GIT_EDITOR=: git rebase -i -p branch1 &&
91 test $(git rev-parse branch2^^) = $(git rev-parse branch1) &&
92 test "23" = "$(cat file1)" &&
93 test "" = "$(cat file6)" &&
94 test "file7" = "$(cat file7)" &&
96 git checkout branch1 &&
98 git checkout branch2 &&
104 # F - G - H -- L \ --> L
106 # I -- G2 -- J -- K I -- G2 -- K
107 # G2 = different changes as G
108 test_expect_success
'keep different-resolution merges with -p' '
109 git checkout branch1 &&
114 git checkout branch2 &&
116 git commit -a -m G2 &&
121 echo file7 > file7 &&
124 ! GIT_EDITOR=: git rebase -i -p branch1 &&
127 GIT_EDITOR=: git rebase --continue &&
128 test $(git rev-parse branch2^^^) = $(git rev-parse branch1) &&
129 test "234" = "$(cat file1)" &&
130 test "" = "$(cat file6)" &&
131 test "file7" = "$(cat file7)" &&
133 git checkout branch1 &&
134 git reset --hard H &&
135 git checkout branch2 &&