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>
Stephan Beyer committed
Jul 12, 2008 at 17:47 UTC
5352a82bab7422fea53679d56fdef878d51b7968
1 file changed
+21
-5
t/t3404-rebase-interactive.sh
+21
-5
@@ -211,7 +211,7 @@ test_expect_success 'preserve merges with -p' '
211
git add unrelated-file &&
212
test_tick &&
213
git commit -m "unrelated" &&
214
- git checkout -b to-be-rebased master &&
214
+ git checkout -b another-branch master &&
215
echo B > file1 &&
216
test_tick &&
217
git commit -m J file1 &&
@@ -220,12 +220,28 @@ test_expect_success 'preserve merges with -p' '
220
echo C > file1 &&
221
test_tick &&
222
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 &&
236
test_tick &&
237
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
245
'
246
247
test_expect_success '--continue tries to commit' '