Skip to content

Commit 11aad46

Browse files
dschogitster
authored andcommitted
tests: optionally skip git rebase -p tests
The `--preserve-merges` mode of the `rebase` command is slated to be deprecated soon, as the more powerful `--rebase-merges` mode is available now, and the latter was designed with the express intent to address the shortcomings of `--preserve-merges`' design (e.g. the inability to reorder commits in an interactive rebase). As such, we will eventually even remove the `--preserve-merges` support, and along with it, its tests. In preparation for this, and also to allow the Windows phase of our automated tests to save some well-needed time when running the test suite, this commit introduces a new prerequisite REBASE_P, which can be forced to being unmet by setting the environment variable `GIT_TEST_SKIP_REBASE_P` to any non-empty string. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5ee4ef8 commit 11aad46

14 files changed

+69
-36
lines changed

t/t3404-rebase-interactive.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ test_expect_success 'retain authorship when squashing' '
312312
git show HEAD | grep "^Author: Twerp Snog"
313313
'
314314

315-
test_expect_success '-p handles "no changes" gracefully' '
315+
test_expect_success REBASE_P '-p handles "no changes" gracefully' '
316316
HEAD=$(git rev-parse HEAD) &&
317317
set_fake_editor &&
318318
git rebase -i -p HEAD^ &&
@@ -322,15 +322,15 @@ test_expect_success '-p handles "no changes" gracefully' '
322322
test $HEAD = $(git rev-parse HEAD)
323323
'
324324

325-
test_expect_failure 'exchange two commits with -p' '
325+
test_expect_failure REBASE_P 'exchange two commits with -p' '
326326
git checkout H &&
327327
set_fake_editor &&
328328
FAKE_LINES="2 1" git rebase -i -p HEAD~2 &&
329329
test H = $(git cat-file commit HEAD^ | sed -ne \$p) &&
330330
test G = $(git cat-file commit HEAD | sed -ne \$p)
331331
'
332332

333-
test_expect_success 'preserve merges with -p' '
333+
test_expect_success REBASE_P 'preserve merges with -p' '
334334
git checkout -b to-be-preserved master^ &&
335335
: > unrelated-file &&
336336
git add unrelated-file &&
@@ -373,7 +373,7 @@ test_expect_success 'preserve merges with -p' '
373373
test $(git show HEAD:unrelated-file) = 1
374374
'
375375

376-
test_expect_success 'edit ancestor with -p' '
376+
test_expect_success REBASE_P 'edit ancestor with -p' '
377377
set_fake_editor &&
378378
FAKE_LINES="1 2 edit 3 4" git rebase -i -p HEAD~3 &&
379379
echo 2 > unrelated-file &&

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: 2 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 &&
@@ -241,6 +241,6 @@ test_rerere_autoupdate
241241
test_rerere_autoupdate -m
242242
GIT_SEQUENCE_EDITOR=: && export GIT_SEQUENCE_EDITOR
243243
test_rerere_autoupdate -i
244-
test_rerere_autoupdate --preserve-merges
244+
test_have_prereq !REBASE_P || test_rerere_autoupdate --preserve-merges
245245

246246
test_done

t/t3421-rebase-topology-linear.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test_run_rebase () {
2929
test_run_rebase success ''
3030
test_run_rebase success -m
3131
test_run_rebase success -i
32-
test_run_rebase success -p
32+
test_have_prereq !REBASE_P || test_run_rebase success -p
3333

3434
test_run_rebase () {
3535
result=$1
@@ -43,7 +43,7 @@ test_run_rebase () {
4343
test_run_rebase success ''
4444
test_run_rebase success -m
4545
test_run_rebase success -i
46-
test_run_rebase success -p
46+
test_have_prereq !REBASE_P || test_run_rebase success -p
4747

4848
test_run_rebase () {
4949
result=$1
@@ -59,7 +59,7 @@ test_run_rebase () {
5959
test_run_rebase success ''
6060
test_run_rebase success -m
6161
test_run_rebase success -i
62-
test_run_rebase failure -p
62+
test_have_prereq !REBASE_P || test_run_rebase failure -p
6363

6464
test_run_rebase () {
6565
result=$1
@@ -73,7 +73,7 @@ test_run_rebase () {
7373
test_run_rebase success ''
7474
test_run_rebase success -m
7575
test_run_rebase success -i
76-
test_run_rebase success -p
76+
test_have_prereq !REBASE_P || test_run_rebase success -p
7777

7878
# f
7979
# /
@@ -113,7 +113,7 @@ test_run_rebase () {
113113
test_run_rebase success ''
114114
test_run_rebase failure -m
115115
test_run_rebase success -i
116-
test_run_rebase success -p
116+
test_have_prereq !REBASE_P || test_run_rebase success -p
117117

118118
test_run_rebase () {
119119
result=$1
@@ -128,7 +128,7 @@ test_run_rebase () {
128128
test_run_rebase success ''
129129
test_run_rebase failure -m
130130
test_run_rebase success -i
131-
test_run_rebase success -p
131+
test_have_prereq !REBASE_P || test_run_rebase success -p
132132

133133
test_run_rebase () {
134134
result=$1
@@ -143,7 +143,7 @@ test_run_rebase () {
143143
test_run_rebase success ''
144144
test_run_rebase failure -m
145145
test_run_rebase success -i
146-
test_run_rebase success -p
146+
test_have_prereq !REBASE_P || test_run_rebase success -p
147147

148148
test_run_rebase () {
149149
result=$1
@@ -158,7 +158,7 @@ test_run_rebase () {
158158
test_run_rebase success ''
159159
test_run_rebase success -m
160160
test_run_rebase success -i
161-
test_run_rebase success -p
161+
test_have_prereq !REBASE_P || test_run_rebase success -p
162162

163163
# a---b---c---j!
164164
# \
@@ -186,7 +186,7 @@ test_run_rebase () {
186186
test_run_rebase success ''
187187
test_run_rebase success -m
188188
test_run_rebase success -i
189-
test_run_rebase success -p
189+
test_have_prereq !REBASE_P || test_run_rebase success -p
190190

191191
test_run_rebase () {
192192
result=$1
@@ -201,7 +201,7 @@ test_run_rebase () {
201201
test_run_rebase success ''
202202
test_run_rebase success -m
203203
test_run_rebase success -i
204-
test_run_rebase failure -p
204+
test_have_prereq !REBASE_P || test_run_rebase failure -p
205205

206206
test_run_rebase () {
207207
result=$1
@@ -216,7 +216,7 @@ test_run_rebase () {
216216
test_run_rebase success ''
217217
test_run_rebase success -m
218218
test_run_rebase success -i
219-
test_run_rebase failure -p
219+
test_have_prereq !REBASE_P || test_run_rebase failure -p
220220
test_run_rebase success --rebase-merges
221221

222222
# m
@@ -256,7 +256,7 @@ test_run_rebase () {
256256
test_run_rebase success ''
257257
test_run_rebase success -m
258258
test_run_rebase success -i
259-
test_run_rebase success -p
259+
test_have_prereq !REBASE_P || test_run_rebase success -p
260260

261261
test_run_rebase () {
262262
result=$1
@@ -271,7 +271,7 @@ test_run_rebase () {
271271
test_run_rebase success ''
272272
test_run_rebase success -m
273273
test_run_rebase success -i
274-
test_run_rebase failure -p
274+
test_have_prereq !REBASE_P || test_run_rebase failure -p
275275

276276
test_run_rebase () {
277277
result=$1
@@ -286,7 +286,7 @@ test_run_rebase () {
286286
test_run_rebase success ''
287287
test_run_rebase failure -m
288288
test_run_rebase success -i
289-
test_run_rebase success -p
289+
test_have_prereq !REBASE_P || test_run_rebase success -p
290290

291291
test_run_rebase () {
292292
result=$1
@@ -302,7 +302,7 @@ test_run_rebase () {
302302
test_run_rebase success ''
303303
test_run_rebase success -m
304304
test_run_rebase success -i
305-
test_run_rebase failure -p
305+
test_have_prereq !REBASE_P || test_run_rebase failure -p
306306

307307
test_run_rebase () {
308308
result=$1
@@ -317,7 +317,7 @@ test_run_rebase () {
317317
test_run_rebase success ''
318318
test_run_rebase failure -m
319319
test_run_rebase success -i
320-
test_run_rebase failure -p
320+
test_have_prereq !REBASE_P || test_run_rebase failure -p
321321

322322
test_run_rebase () {
323323
result=$1
@@ -331,7 +331,7 @@ test_run_rebase () {
331331
test_run_rebase success ''
332332
test_run_rebase success -m
333333
test_run_rebase success -i
334-
test_run_rebase failure -p
334+
test_have_prereq !REBASE_P || test_run_rebase failure -p
335335

336336
test_run_rebase () {
337337
result=$1
@@ -346,6 +346,6 @@ test_run_rebase () {
346346
test_run_rebase success ''
347347
test_run_rebase success -m
348348
test_run_rebase success -i
349-
test_run_rebase success -p
349+
test_have_prereq !REBASE_P || test_run_rebase success -p
350350

351351
test_done

t/t3425-rebase-topology-merges.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ test_run_rebase success 'd e n o' ''
109109
test_run_rebase success 'd e n o' -m
110110
test_run_rebase success 'd n o e' -i
111111

112+
if ! test_have_prereq REBASE_P; then
113+
skip_all='skipping git rebase -p tests, as asked for'
114+
test_done
115+
fi
116+
112117
test_expect_success "rebase -p is no-op in non-linear history" "
113118
reset_rebase &&
114119
git rebase -p d w &&

0 commit comments

Comments
 (0)