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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Oct 31, 2018 at 13:02 UTC 11aad46432b21f9779a3f303335b8e0a187f98a1
14 files changed +69 -36
t/t3404-rebase-interactive.sh
+4 -4
@@ -312,7 +312,7 @@ test_expect_success 'retain authorship when squashing' '
312 git show HEAD | grep "^Author: Twerp Snog"
313 '
314
315 -test_expect_success '-p handles "no changes" gracefully' '
315 +test_expect_success REBASE_P '-p handles "no changes" gracefully' '
316 HEAD=$(git rev-parse HEAD) &&
317 set_fake_editor &&
318 git rebase -i -p HEAD^ &&
@@ -322,7 +322,7 @@ test_expect_success '-p handles "no changes" gracefully' '
322 test $HEAD = $(git rev-parse HEAD)
323 '
324
325 -test_expect_failure 'exchange two commits with -p' '
325 +test_expect_failure REBASE_P 'exchange two commits with -p' '
326 git checkout H &&
327 set_fake_editor &&
328 FAKE_LINES="2 1" git rebase -i -p HEAD~2 &&
@@ -330,7 +330,7 @@ test_expect_failure 'exchange two commits with -p' '
330 test G = $(git cat-file commit HEAD | sed -ne \$p)
331 '
332
333 -test_expect_success 'preserve merges with -p' '
333 +test_expect_success REBASE_P 'preserve merges with -p' '
334 git checkout -b to-be-preserved master^ &&
335 : > unrelated-file &&
336 git add unrelated-file &&
@@ -373,7 +373,7 @@ test_expect_success 'preserve merges with -p' '
373 test $(git show HEAD:unrelated-file) = 1
374 '
375
376 -test_expect_success 'edit ancestor with -p' '
376 +test_expect_success REBASE_P 'edit ancestor with -p' '
377 set_fake_editor &&
378 FAKE_LINES="1 2 edit 3 4" git rebase -i -p HEAD~3 &&
379 echo 2 > unrelated-file &&
t/t3408-rebase-multi-line.sh
+1 -1
@@ -52,7 +52,7 @@ test_expect_success rebase '
52 test_cmp expect actual
53
54 '
55 -test_expect_success rebasep '
55 +test_expect_success REBASE_P rebasep '
56
57 git checkout side-merge &&
58 git rebase -p side &&
t/t3409-rebase-preserve-merges.sh
+5
@@ -8,6 +8,11 @@ Run "git rebase -p" and check that merges are properly carried along
8 '
9 . ./test-lib.sh
10
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 +
16 GIT_AUTHOR_EMAIL=bogus_email_address
17 export GIT_AUTHOR_EMAIL
18
t/t3410-rebase-preserve-dropped-merges.sh
+5
@@ -11,6 +11,11 @@ rewritten.
11 '
12 . ./test-lib.sh
13
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 +
19 # set up two branches like this:
20 #
21 # A - B - C - D - E
t/t3411-rebase-preserve-around-merges.sh
+5
@@ -10,6 +10,11 @@ a merge to before the merge.
10 '
11 . ./test-lib.sh
12
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 +
18 . "$TEST_DIRECTORY"/lib-rebase.sh
19
20 set_fake_editor
t/t3412-rebase-root.sh
+6 -6
@@ -86,14 +86,14 @@ test_expect_success 'pre-rebase got correct input (4)' '
86 test "z$(cat .git/PRE-REBASE-INPUT)" = z--root,work4
87 '
88
89 -test_expect_success 'rebase -i -p with linear history' '
89 +test_expect_success REBASE_P 'rebase -i -p with linear history' '
90 git checkout -b work5 other &&
91 git rebase -i -p --root --onto master &&
92 git log --pretty=tformat:"%s" > rebased5 &&
93 test_cmp expect rebased5
94 '
95
96 -test_expect_success 'pre-rebase got correct input (5)' '
96 +test_expect_success REBASE_P 'pre-rebase got correct input (5)' '
97 test "z$(cat .git/PRE-REBASE-INPUT)" = z--root,
98 '
99
@@ -120,7 +120,7 @@ commit work6~4
120 1
121 EOF
122
123 -test_expect_success 'rebase -i -p with merge' '
123 +test_expect_success REBASE_P 'rebase -i -p with merge' '
124 git checkout -b work6 other &&
125 git rebase -i -p --root --onto master &&
126 log_with_names work6 > rebased6 &&
@@ -155,7 +155,7 @@ commit work7~5
155 1
156 EOF
157
158 -test_expect_success 'rebase -i -p with two roots' '
158 +test_expect_success REBASE_P 'rebase -i -p with two roots' '
159 git checkout -b work7 other &&
160 git rebase -i -p --root --onto master &&
161 log_with_names work7 > rebased7 &&
@@ -261,7 +261,7 @@ commit conflict3~6
261 1
262 EOF
263
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)' '
265 git checkout -b conflict3 other &&
266 test_must_fail git rebase -i -p --root --onto master &&
267 git ls-files -u | grep "B$"
@@ -272,7 +272,7 @@ test_expect_success 'fix the conflict' '
272 git add B
273 '
274
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)' '
276 git rebase --continue &&
277 log_with_names conflict3 >out &&
278 test_cmp expect-conflict-p out
t/t3414-rebase-preserve-onto.sh
+5
@@ -10,6 +10,11 @@ aren'"'"'t on top of $ONTO, even if they are on top of $UPSTREAM.
10 '
11 . ./test-lib.sh
12
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 +
18 . "$TEST_DIRECTORY"/lib-rebase.sh
19
20 # Set up branches like this:
t/t3418-rebase-continue.sh
+2 -2
@@ -106,7 +106,7 @@ test_expect_success 'rebase -i --continue handles merge strategy and options' '
106 test -f funny.was.run
107 '
108
109 -test_expect_success 'rebase passes merge strategy options correctly' '
109 +test_expect_success REBASE_P 'rebase passes merge strategy options correctly' '
110 rm -fr .git/rebase-* &&
111 git reset --hard commit-new-file-F3-on-topic-branch &&
112 test_commit theirs-to-merge &&
@@ -241,6 +241,6 @@ test_rerere_autoupdate
241 test_rerere_autoupdate -m
242 GIT_SEQUENCE_EDITOR=: && export GIT_SEQUENCE_EDITOR
243 test_rerere_autoupdate -i
244 -test_rerere_autoupdate --preserve-merges
244 +test_have_prereq !REBASE_P || test_rerere_autoupdate --preserve-merges
245
246 test_done
t/t3421-rebase-topology-linear.sh
+18 -18
@@ -29,7 +29,7 @@ test_run_rebase () {
29 test_run_rebase success ''
30 test_run_rebase success -m
31 test_run_rebase success -i
32 -test_run_rebase success -p
32 +test_have_prereq !REBASE_P || test_run_rebase success -p
33
34 test_run_rebase () {
35 result=$1
@@ -43,7 +43,7 @@ test_run_rebase () {
43 test_run_rebase success ''
44 test_run_rebase success -m
45 test_run_rebase success -i
46 -test_run_rebase success -p
46 +test_have_prereq !REBASE_P || test_run_rebase success -p
47
48 test_run_rebase () {
49 result=$1
@@ -59,7 +59,7 @@ test_run_rebase () {
59 test_run_rebase success ''
60 test_run_rebase success -m
61 test_run_rebase success -i
62 -test_run_rebase failure -p
62 +test_have_prereq !REBASE_P || test_run_rebase failure -p
63
64 test_run_rebase () {
65 result=$1
@@ -73,7 +73,7 @@ test_run_rebase () {
73 test_run_rebase success ''
74 test_run_rebase success -m
75 test_run_rebase success -i
76 -test_run_rebase success -p
76 +test_have_prereq !REBASE_P || test_run_rebase success -p
77
78 # f
79 # /
@@ -113,7 +113,7 @@ test_run_rebase () {
113 test_run_rebase success ''
114 test_run_rebase failure -m
115 test_run_rebase success -i
116 -test_run_rebase success -p
116 +test_have_prereq !REBASE_P || test_run_rebase success -p
117
118 test_run_rebase () {
119 result=$1
@@ -128,7 +128,7 @@ test_run_rebase () {
128 test_run_rebase success ''
129 test_run_rebase failure -m
130 test_run_rebase success -i
131 -test_run_rebase success -p
131 +test_have_prereq !REBASE_P || test_run_rebase success -p
132
133 test_run_rebase () {
134 result=$1
@@ -143,7 +143,7 @@ test_run_rebase () {
143 test_run_rebase success ''
144 test_run_rebase failure -m
145 test_run_rebase success -i
146 -test_run_rebase success -p
146 +test_have_prereq !REBASE_P || test_run_rebase success -p
147
148 test_run_rebase () {
149 result=$1
@@ -158,7 +158,7 @@ test_run_rebase () {
158 test_run_rebase success ''
159 test_run_rebase success -m
160 test_run_rebase success -i
161 -test_run_rebase success -p
161 +test_have_prereq !REBASE_P || test_run_rebase success -p
162
163 # a---b---c---j!
164 # \
@@ -186,7 +186,7 @@ test_run_rebase () {
186 test_run_rebase success ''
187 test_run_rebase success -m
188 test_run_rebase success -i
189 -test_run_rebase success -p
189 +test_have_prereq !REBASE_P || test_run_rebase success -p
190
191 test_run_rebase () {
192 result=$1
@@ -201,7 +201,7 @@ test_run_rebase () {
201 test_run_rebase success ''
202 test_run_rebase success -m
203 test_run_rebase success -i
204 -test_run_rebase failure -p
204 +test_have_prereq !REBASE_P || test_run_rebase failure -p
205
206 test_run_rebase () {
207 result=$1
@@ -216,7 +216,7 @@ test_run_rebase () {
216 test_run_rebase success ''
217 test_run_rebase success -m
218 test_run_rebase success -i
219 -test_run_rebase failure -p
219 +test_have_prereq !REBASE_P || test_run_rebase failure -p
220 test_run_rebase success --rebase-merges
221
222 # m
@@ -256,7 +256,7 @@ test_run_rebase () {
256 test_run_rebase success ''
257 test_run_rebase success -m
258 test_run_rebase success -i
259 -test_run_rebase success -p
259 +test_have_prereq !REBASE_P || test_run_rebase success -p
260
261 test_run_rebase () {
262 result=$1
@@ -271,7 +271,7 @@ test_run_rebase () {
271 test_run_rebase success ''
272 test_run_rebase success -m
273 test_run_rebase success -i
274 -test_run_rebase failure -p
274 +test_have_prereq !REBASE_P || test_run_rebase failure -p
275
276 test_run_rebase () {
277 result=$1
@@ -286,7 +286,7 @@ test_run_rebase () {
286 test_run_rebase success ''
287 test_run_rebase failure -m
288 test_run_rebase success -i
289 -test_run_rebase success -p
289 +test_have_prereq !REBASE_P || test_run_rebase success -p
290
291 test_run_rebase () {
292 result=$1
@@ -302,7 +302,7 @@ test_run_rebase () {
302 test_run_rebase success ''
303 test_run_rebase success -m
304 test_run_rebase success -i
305 -test_run_rebase failure -p
305 +test_have_prereq !REBASE_P || test_run_rebase failure -p
306
307 test_run_rebase () {
308 result=$1
@@ -317,7 +317,7 @@ test_run_rebase () {
317 test_run_rebase success ''
318 test_run_rebase failure -m
319 test_run_rebase success -i
320 -test_run_rebase failure -p
320 +test_have_prereq !REBASE_P || test_run_rebase failure -p
321
322 test_run_rebase () {
323 result=$1
@@ -331,7 +331,7 @@ test_run_rebase () {
331 test_run_rebase success ''
332 test_run_rebase success -m
333 test_run_rebase success -i
334 -test_run_rebase failure -p
334 +test_have_prereq !REBASE_P || test_run_rebase failure -p
335
336 test_run_rebase () {
337 result=$1
@@ -346,6 +346,6 @@ test_run_rebase () {
346 test_run_rebase success ''
347 test_run_rebase success -m
348 test_run_rebase success -i
349 -test_run_rebase success -p
349 +test_have_prereq !REBASE_P || test_run_rebase success -p
350
351 test_done
t/t3425-rebase-topology-merges.sh
+5
@@ -109,6 +109,11 @@ test_run_rebase success 'd e n o' ''
109 test_run_rebase success 'd e n o' -m
110 test_run_rebase success 'd n o e' -i
111
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 +
117 test_expect_success "rebase -p is no-op in non-linear history" "
118 reset_rebase &&
119 git rebase -p d w &&
t/t5520-pull.sh
+4 -2
@@ -461,7 +461,8 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '
461 test file3 = "$(git show HEAD:file3.t)"
462 '
463
464 -test_expect_success 'pull.rebase=preserve rebases and merges keep-merge' '
464 +test_expect_success REBASE_P \
465 + 'pull.rebase=preserve rebases and merges keep-merge' '
466 git reset --hard before-preserve-rebase &&
467 test_config pull.rebase preserve &&
468 git pull . copy &&
@@ -514,7 +515,8 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '
515 test file3 = "$(git show HEAD:file3.t)"
516 '
517
517 -test_expect_success '--rebase=preserve rebases and merges keep-merge' '
518 +test_expect_success REBASE_P \
519 + '--rebase=preserve rebases and merges keep-merge' '
520 git reset --hard before-preserve-rebase &&
521 test_config pull.rebase true &&
522 git pull --rebase=preserve . copy &&
t/t7505-prepare-commit-msg-hook.sh
+1 -1
@@ -253,7 +253,7 @@ test_rebase () {
253 }
254
255 test_rebase success -i
256 -test_rebase success -p
256 +test_have_prereq !REBASE_P || test_rebase success -p
257
258 test_expect_success 'with hook (cherry-pick)' '
259 test_when_finished "git checkout -f master" &&
t/t7517-per-repo-email.sh
+4 -2
@@ -72,12 +72,14 @@ test_expect_success 'noop interactive rebase does not care about ident' '
72 git rebase -i HEAD^
73 '
74
75 -test_expect_success 'fast-forward rebase does not care about ident (preserve)' '
75 +test_expect_success REBASE_P \
76 + 'fast-forward rebase does not care about ident (preserve)' '
77 git checkout -B tmp side-without-commit &&
78 git rebase -p master
79 '
80
80 -test_expect_success 'non-fast-forward rebase refuses to write commits (preserve)' '
81 +test_expect_success REBASE_P \
82 + 'non-fast-forward rebase refuses to write commits (preserve)' '
83 test_when_finished "git rebase --abort || true" &&
84 git checkout -B tmp side-with-commit &&
85 test_must_fail git rebase -p master
t/test-lib.sh
+4
@@ -1268,3 +1268,7 @@ test_lazy_prereq CURL '
1268 test_lazy_prereq SHA1 '
1269 test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
1270 '
1271 +
1272 +test_lazy_prereq REBASE_P '
1273 + test -z "$GIT_TEST_SKIP_REBASE_P"
1274 +'