Skip to content

Commit 6e31fa9

Browse files
committed
Merge branch 'js/rebase-p-tests'
In preparation to the day when we can deprecate and remove the "rebase -p", make sure we can skip and later remove tests for it. * js/rebase-p-tests: tests: optionally skip `git rebase -p` tests t3418: decouple test cases from a previous `rebase -p` test case t3404: decouple some test cases from outcomes of previous test cases
2 parents 6b2a524 + 11aad46 commit 6e31fa9

14 files changed

+78
-43
lines changed

t/t3404-rebase-interactive.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ test_expect_success 'retain authorship when squashing' '
322322
git show HEAD | grep "^Author: Twerp Snog"
323323
'
324324

325-
test_expect_success '-p handles "no changes" gracefully' '
325+
test_expect_success REBASE_P '-p handles "no changes" gracefully' '
326326
HEAD=$(git rev-parse HEAD) &&
327327
set_fake_editor &&
328328
git rebase -i -p HEAD^ &&
@@ -332,15 +332,15 @@ test_expect_success '-p handles "no changes" gracefully' '
332332
test $HEAD = $(git rev-parse HEAD)
333333
'
334334

335-
test_expect_failure 'exchange two commits with -p' '
335+
test_expect_failure REBASE_P 'exchange two commits with -p' '
336336
git checkout H &&
337337
set_fake_editor &&
338338
FAKE_LINES="2 1" git rebase -i -p HEAD~2 &&
339339
test H = $(git cat-file commit HEAD^ | sed -ne \$p) &&
340340
test G = $(git cat-file commit HEAD | sed -ne \$p)
341341
'
342342

343-
test_expect_success 'preserve merges with -p' '
343+
test_expect_success REBASE_P 'preserve merges with -p' '
344344
git checkout -b to-be-preserved master^ &&
345345
: > unrelated-file &&
346346
git add unrelated-file &&
@@ -383,7 +383,7 @@ test_expect_success 'preserve merges with -p' '
383383
test $(git show HEAD:unrelated-file) = 1
384384
'
385385

386-
test_expect_success 'edit ancestor with -p' '
386+
test_expect_success REBASE_P 'edit ancestor with -p' '
387387
set_fake_editor &&
388388
FAKE_LINES="1 2 edit 3 4" git rebase -i -p HEAD~3 &&
389389
echo 2 > unrelated-file &&
@@ -397,6 +397,7 @@ test_expect_success 'edit ancestor with -p' '
397397
'
398398

399399
test_expect_success '--continue tries to commit' '
400+
git reset --hard D &&
400401
test_tick &&
401402
set_fake_editor &&
402403
test_must_fail git rebase -i --onto new-branch1 HEAD^ &&
@@ -436,7 +437,7 @@ test_expect_success C_LOCALE_OUTPUT 'multi-fixup does not fire up editor' '
436437
git rebase -i $base &&
437438
test $base = $(git rev-parse HEAD^) &&
438439
test 0 = $(git show | grep NEVER | wc -l) &&
439-
git checkout to-be-rebased &&
440+
git checkout @{-1} &&
440441
git branch -D multi-fixup
441442
'
442443

@@ -451,7 +452,7 @@ test_expect_success 'commit message used after conflict' '
451452
git rebase --continue &&
452453
test $base = $(git rev-parse HEAD^) &&
453454
test 1 = $(git show | grep ONCE | wc -l) &&
454-
git checkout to-be-rebased &&
455+
git checkout @{-1} &&
455456
git branch -D conflict-fixup
456457
'
457458

@@ -466,7 +467,7 @@ test_expect_success 'commit message retained after conflict' '
466467
git rebase --continue &&
467468
test $base = $(git rev-parse HEAD^) &&
468469
test 2 = $(git show | grep TWICE | wc -l) &&
469-
git checkout to-be-rebased &&
470+
git checkout @{-1} &&
470471
git branch -D conflict-squash
471472
'
472473

@@ -491,7 +492,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messa
491492
grep "^# This is a combination of 3 commits\." &&
492493
git cat-file commit HEAD@{3} |
493494
grep "^# This is a combination of 2 commits\." &&
494-
git checkout to-be-rebased &&
495+
git checkout @{-1} &&
495496
git branch -D squash-fixup
496497
'
497498

@@ -504,7 +505,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' '
504505
git rebase -i $base &&
505506
test $base = $(git rev-parse HEAD^) &&
506507
test 1 = $(git show | grep ONCE | wc -l) &&
507-
git checkout to-be-rebased &&
508+
git checkout @{-1} &&
508509
git branch -D skip-comments
509510
'
510511

@@ -517,7 +518,7 @@ test_expect_success C_LOCALE_OUTPUT 'squash ignores blank lines' '
517518
git rebase -i $base &&
518519
test $base = $(git rev-parse HEAD^) &&
519520
test 1 = $(git show | grep ONCE | wc -l) &&
520-
git checkout to-be-rebased &&
521+
git checkout @{-1} &&
521522
git branch -D skip-blank-lines
522523
'
523524

@@ -658,7 +659,7 @@ test_expect_success 'rebase with a file named HEAD in worktree' '
658659
) &&
659660
660661
set_fake_editor &&
661-
FAKE_LINES="1 squash 2" git rebase -i to-be-rebased &&
662+
FAKE_LINES="1 squash 2" git rebase -i @{-1} &&
662663
test "$(git show -s --pretty=format:%an)" = "Squashed Away"
663664
664665
'

t/t3408-rebase-multi-line.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ test_expect_success rebase '
5252
test_cmp expect actual
5353
5454
'
55-
test_expect_success rebasep '
55+
test_expect_success REBASE_P rebasep '
5656
5757
git checkout side-merge &&
5858
git rebase -p side &&

t/t3409-rebase-preserve-merges.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Run "git rebase -p" and check that merges are properly carried along
88
'
99
. ./test-lib.sh
1010

11+
if ! test_have_prereq REBASE_P; then
12+
skip_all='skipping git rebase -p tests, as asked for'
13+
test_done
14+
fi
15+
1116
GIT_AUTHOR_EMAIL=bogus_email_address
1217
export GIT_AUTHOR_EMAIL
1318

t/t3410-rebase-preserve-dropped-merges.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ rewritten.
1111
'
1212
. ./test-lib.sh
1313

14+
if ! test_have_prereq REBASE_P; then
15+
skip_all='skipping git rebase -p tests, as asked for'
16+
test_done
17+
fi
18+
1419
# set up two branches like this:
1520
#
1621
# A - B - C - D - E

t/t3411-rebase-preserve-around-merges.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ a merge to before the merge.
1010
'
1111
. ./test-lib.sh
1212

13+
if ! test_have_prereq REBASE_P; then
14+
skip_all='skipping git rebase -p tests, as asked for'
15+
test_done
16+
fi
17+
1318
. "$TEST_DIRECTORY"/lib-rebase.sh
1419

1520
set_fake_editor

t/t3412-rebase-root.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ test_expect_success 'pre-rebase got correct input (4)' '
8686
test "z$(cat .git/PRE-REBASE-INPUT)" = z--root,work4
8787
'
8888

89-
test_expect_success 'rebase -i -p with linear history' '
89+
test_expect_success REBASE_P 'rebase -i -p with linear history' '
9090
git checkout -b work5 other &&
9191
git rebase -i -p --root --onto master &&
9292
git log --pretty=tformat:"%s" > rebased5 &&
9393
test_cmp expect rebased5
9494
'
9595

96-
test_expect_success 'pre-rebase got correct input (5)' '
96+
test_expect_success REBASE_P 'pre-rebase got correct input (5)' '
9797
test "z$(cat .git/PRE-REBASE-INPUT)" = z--root,
9898
'
9999

@@ -120,7 +120,7 @@ commit work6~4
120120
1
121121
EOF
122122

123-
test_expect_success 'rebase -i -p with merge' '
123+
test_expect_success REBASE_P 'rebase -i -p with merge' '
124124
git checkout -b work6 other &&
125125
git rebase -i -p --root --onto master &&
126126
log_with_names work6 > rebased6 &&
@@ -155,7 +155,7 @@ commit work7~5
155155
1
156156
EOF
157157

158-
test_expect_success 'rebase -i -p with two roots' '
158+
test_expect_success REBASE_P 'rebase -i -p with two roots' '
159159
git checkout -b work7 other &&
160160
git rebase -i -p --root --onto master &&
161161
log_with_names work7 > rebased7 &&
@@ -261,7 +261,7 @@ commit conflict3~6
261261
1
262262
EOF
263263

264-
test_expect_success 'rebase -i -p --root with conflict (first part)' '
264+
test_expect_success REBASE_P 'rebase -i -p --root with conflict (first part)' '
265265
git checkout -b conflict3 other &&
266266
test_must_fail git rebase -i -p --root --onto master &&
267267
git ls-files -u | grep "B$"
@@ -272,7 +272,7 @@ test_expect_success 'fix the conflict' '
272272
git add B
273273
'
274274

275-
test_expect_success 'rebase -i -p --root with conflict (second part)' '
275+
test_expect_success REBASE_P 'rebase -i -p --root with conflict (second part)' '
276276
git rebase --continue &&
277277
log_with_names conflict3 >out &&
278278
test_cmp expect-conflict-p out

t/t3414-rebase-preserve-onto.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ aren'"'"'t on top of $ONTO, even if they are on top of $UPSTREAM.
1010
'
1111
. ./test-lib.sh
1212

13+
if ! test_have_prereq REBASE_P; then
14+
skip_all='skipping git rebase -p tests, as asked for'
15+
test_done
16+
fi
17+
1318
. "$TEST_DIRECTORY"/lib-rebase.sh
1419

1520
# Set up branches like this:

t/t3418-rebase-continue.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ test_expect_success 'rebase -i --continue handles merge strategy and options' '
106106
test -f funny.was.run
107107
'
108108

109-
test_expect_success 'rebase passes merge strategy options correctly' '
109+
test_expect_success REBASE_P 'rebase passes merge strategy options correctly' '
110110
rm -fr .git/rebase-* &&
111111
git reset --hard commit-new-file-F3-on-topic-branch &&
112112
test_commit theirs-to-merge &&
@@ -177,6 +177,7 @@ test_expect_success 'setup rerere database' '
177177
git checkout master &&
178178
test_commit "commit-new-file-F3" F3 3 &&
179179
test_config rerere.enabled true &&
180+
git update-ref refs/heads/topic commit-new-file-F3-on-topic-branch &&
180181
test_must_fail git rebase -m master topic &&
181182
echo "Resolved" >F2 &&
182183
cp F2 expected-F2 &&
@@ -240,7 +241,7 @@ test_rerere_autoupdate
240241
test_rerere_autoupdate -m
241242
GIT_SEQUENCE_EDITOR=: && export GIT_SEQUENCE_EDITOR
242243
test_rerere_autoupdate -i
243-
test_rerere_autoupdate --preserve-merges
244+
test_have_prereq !REBASE_P || test_rerere_autoupdate --preserve-merges
244245
unset GIT_SEQUENCE_EDITOR
245246

246247
test_expect_success 'the todo command "break" works' '

0 commit comments

Comments
 (0)