Skip to content

Commit 6c8fbae

Browse files
dschogitster
authored andcommitted
t3404: decouple some test cases from outcomes of previous test cases
Originally, the `--preserve-merges` option of the `git rebase` command piggy-backed on top of the `--interactive` feature. For that reason, the early test cases were added to the very same test script that contains the `git rebase -i` tests: `t3404-rebase-interactive.sh`. However, since c42abfe (rebase: introduce a dedicated backend for --preserve-merges, 2018-05-28), the `--preserve-merges` feature got its own backend, in preparation for converting the rest of the `--interactive` code to built-in code, written in C rather than shell. The reason why the `--preserve-merges` feature was not converted at the same time is that we have something much better now: `--rebase-merges`. That option intends to supersede `--preserve-merges`, and we will probably deprecate the latter soon. Once `--preserve-merges` has been deprecated for a good amount of time, it will be time to remove it, and along with it, its tests. In preparation for that, let's make the rest of the test cases in `t3404-rebase-interactive.sh` independent of the test cases dedicated to `--preserve-merges`. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4ede3d4 commit 6c8fbae

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

t/t3404-rebase-interactive.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ test_expect_success 'edit ancestor with -p' '
387387
'
388388

389389
test_expect_success '--continue tries to commit' '
390+
git reset --hard D &&
390391
test_tick &&
391392
set_fake_editor &&
392393
test_must_fail git rebase -i --onto new-branch1 HEAD^ &&
@@ -426,7 +427,7 @@ test_expect_success C_LOCALE_OUTPUT 'multi-fixup does not fire up editor' '
426427
git rebase -i $base &&
427428
test $base = $(git rev-parse HEAD^) &&
428429
test 0 = $(git show | grep NEVER | wc -l) &&
429-
git checkout to-be-rebased &&
430+
git checkout @{-1} &&
430431
git branch -D multi-fixup
431432
'
432433

@@ -441,7 +442,7 @@ test_expect_success 'commit message used after conflict' '
441442
git rebase --continue &&
442443
test $base = $(git rev-parse HEAD^) &&
443444
test 1 = $(git show | grep ONCE | wc -l) &&
444-
git checkout to-be-rebased &&
445+
git checkout @{-1} &&
445446
git branch -D conflict-fixup
446447
'
447448

@@ -456,7 +457,7 @@ test_expect_success 'commit message retained after conflict' '
456457
git rebase --continue &&
457458
test $base = $(git rev-parse HEAD^) &&
458459
test 2 = $(git show | grep TWICE | wc -l) &&
459-
git checkout to-be-rebased &&
460+
git checkout @{-1} &&
460461
git branch -D conflict-squash
461462
'
462463

@@ -481,7 +482,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messa
481482
grep "^# This is a combination of 3 commits\." &&
482483
git cat-file commit HEAD@{3} |
483484
grep "^# This is a combination of 2 commits\." &&
484-
git checkout to-be-rebased &&
485+
git checkout @{-1} &&
485486
git branch -D squash-fixup
486487
'
487488

@@ -494,7 +495,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' '
494495
git rebase -i $base &&
495496
test $base = $(git rev-parse HEAD^) &&
496497
test 1 = $(git show | grep ONCE | wc -l) &&
497-
git checkout to-be-rebased &&
498+
git checkout @{-1} &&
498499
git branch -D skip-comments
499500
'
500501

@@ -507,7 +508,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash ignores blank lines' '
507508
git rebase -i $base &&
508509
test $base = $(git rev-parse HEAD^) &&
509510
test 1 = $(git show | grep ONCE | wc -l) &&
510-
git checkout to-be-rebased &&
511+
git checkout @{-1} &&
511512
git branch -D skip-blank-lines
512513
'
513514

@@ -648,7 +649,7 @@ test_expect_success 'rebase with a file named HEAD in worktree' '
648649
) &&
649650
650651
set_fake_editor &&
651-
FAKE_LINES="1 squash 2" git rebase -i to-be-rebased &&
652+
FAKE_LINES="1 squash 2" git rebase -i @{-1} &&
652653
test "$(git show -s --pretty=format:%an)" = "Squashed Away"
653654
654655
'

0 commit comments

Comments
 (0)