Skip to content

Commit 5352a82

Browse files
sbeyergitster
authored andcommitted
t3404: test two "preserve merges with -p" cases
There are two cases for preserving merges: 1. The merge base is outside the trunk that is to be rebased. Then commits of those other parents must not be picked. 2. The merge base is inside the trunk that is to be rebased. Then all the commits related to that merge must be picked and the merge must be redone. The "preserve merges with -p" test case tested for case 1 only. This patch adds case 2. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 356a32a commit 5352a82

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

t/t3404-rebase-interactive.sh

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ test_expect_success 'preserve merges with -p' '
211211
git add unrelated-file &&
212212
test_tick &&
213213
git commit -m "unrelated" &&
214-
git checkout -b to-be-rebased master &&
214+
git checkout -b another-branch master &&
215215
echo B > file1 &&
216216
test_tick &&
217217
git commit -m J file1 &&
@@ -220,12 +220,28 @@ test_expect_success 'preserve merges with -p' '
220220
echo C > file1 &&
221221
test_tick &&
222222
git commit -m K file1 &&
223+
echo D > file1 &&
224+
test_tick &&
225+
git commit -m L1 file1 &&
226+
git checkout HEAD^ &&
227+
echo 1 > unrelated-file &&
228+
test_tick &&
229+
git commit -m L2 unrelated-file &&
230+
test_tick &&
231+
git merge another-branch &&
232+
echo E > file1 &&
233+
test_tick &&
234+
git commit -m M file1 &&
235+
git checkout -b to-be-rebased &&
223236
test_tick &&
224237
git rebase -i -p --onto branch1 master &&
225-
test $(git rev-parse HEAD^^2) = $(git rev-parse to-be-preserved) &&
226-
test $(git rev-parse HEAD~3) = $(git rev-parse branch1) &&
227-
test $(git show HEAD:file1) = C &&
228-
test $(git show HEAD~2:file1) = B
238+
test $(git rev-parse HEAD~6) = $(git rev-parse branch1) &&
239+
test $(git rev-parse HEAD~4^2) = $(git rev-parse to-be-preserved) &&
240+
test $(git rev-parse HEAD^^2^) = $(git rev-parse HEAD^^^) &&
241+
test $(git show HEAD~5:file1) = B &&
242+
test $(git show HEAD~3:file1) = C &&
243+
test $(git show HEAD:file1) = E &&
244+
test $(git show HEAD:unrelated-file) = 1
229245
'
230246

231247
test_expect_success '--continue tries to commit' '

0 commit comments

Comments
 (0)