1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-08 14:46:11 +02:00

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>
This commit is contained in:
Johannes Schindelin 2018-10-31 13:02:02 -07:00 committed by Junio C Hamano
parent 5ee4ef8bda
commit 11aad46432
14 changed files with 69 additions and 36 deletions

View File

@ -312,7 +312,7 @@ test_expect_success 'retain authorship when squashing' '
git show HEAD | grep "^Author: Twerp Snog"
'
test_expect_success '-p handles "no changes" gracefully' '
test_expect_success REBASE_P '-p handles "no changes" gracefully' '
HEAD=$(git rev-parse HEAD) &&
set_fake_editor &&
git rebase -i -p HEAD^ &&
@ -322,7 +322,7 @@ test_expect_success '-p handles "no changes" gracefully' '
test $HEAD = $(git rev-parse HEAD)
'
test_expect_failure 'exchange two commits with -p' '
test_expect_failure REBASE_P 'exchange two commits with -p' '
git checkout H &&
set_fake_editor &&
FAKE_LINES="2 1" git rebase -i -p HEAD~2 &&
@ -330,7 +330,7 @@ test_expect_failure 'exchange two commits with -p' '
test G = $(git cat-file commit HEAD | sed -ne \$p)
'
test_expect_success 'preserve merges with -p' '
test_expect_success REBASE_P 'preserve merges with -p' '
git checkout -b to-be-preserved master^ &&
: > unrelated-file &&
git add unrelated-file &&
@ -373,7 +373,7 @@ test_expect_success 'preserve merges with -p' '
test $(git show HEAD:unrelated-file) = 1
'
test_expect_success 'edit ancestor with -p' '
test_expect_success REBASE_P 'edit ancestor with -p' '
set_fake_editor &&
FAKE_LINES="1 2 edit 3 4" git rebase -i -p HEAD~3 &&
echo 2 > unrelated-file &&

View File

@ -52,7 +52,7 @@ test_expect_success rebase '
test_cmp expect actual
'
test_expect_success rebasep '
test_expect_success REBASE_P rebasep '
git checkout side-merge &&
git rebase -p side &&

View File

@ -8,6 +8,11 @@ Run "git rebase -p" and check that merges are properly carried along
'
. ./test-lib.sh
if ! test_have_prereq REBASE_P; then
skip_all='skipping git rebase -p tests, as asked for'
test_done
fi
GIT_AUTHOR_EMAIL=bogus_email_address
export GIT_AUTHOR_EMAIL

View File

@ -11,6 +11,11 @@ rewritten.
'
. ./test-lib.sh
if ! test_have_prereq REBASE_P; then
skip_all='skipping git rebase -p tests, as asked for'
test_done
fi
# set up two branches like this:
#
# A - B - C - D - E

View File

@ -10,6 +10,11 @@ a merge to before the merge.
'
. ./test-lib.sh
if ! test_have_prereq REBASE_P; then
skip_all='skipping git rebase -p tests, as asked for'
test_done
fi
. "$TEST_DIRECTORY"/lib-rebase.sh
set_fake_editor

View File

@ -86,14 +86,14 @@ test_expect_success 'pre-rebase got correct input (4)' '
test "z$(cat .git/PRE-REBASE-INPUT)" = z--root,work4
'
test_expect_success 'rebase -i -p with linear history' '
test_expect_success REBASE_P 'rebase -i -p with linear history' '
git checkout -b work5 other &&
git rebase -i -p --root --onto master &&
git log --pretty=tformat:"%s" > rebased5 &&
test_cmp expect rebased5
'
test_expect_success 'pre-rebase got correct input (5)' '
test_expect_success REBASE_P 'pre-rebase got correct input (5)' '
test "z$(cat .git/PRE-REBASE-INPUT)" = z--root,
'
@ -120,7 +120,7 @@ commit work6~4
1
EOF
test_expect_success 'rebase -i -p with merge' '
test_expect_success REBASE_P 'rebase -i -p with merge' '
git checkout -b work6 other &&
git rebase -i -p --root --onto master &&
log_with_names work6 > rebased6 &&
@ -155,7 +155,7 @@ commit work7~5
1
EOF
test_expect_success 'rebase -i -p with two roots' '
test_expect_success REBASE_P 'rebase -i -p with two roots' '
git checkout -b work7 other &&
git rebase -i -p --root --onto master &&
log_with_names work7 > rebased7 &&
@ -261,7 +261,7 @@ commit conflict3~6
1
EOF
test_expect_success 'rebase -i -p --root with conflict (first part)' '
test_expect_success REBASE_P 'rebase -i -p --root with conflict (first part)' '
git checkout -b conflict3 other &&
test_must_fail git rebase -i -p --root --onto master &&
git ls-files -u | grep "B$"
@ -272,7 +272,7 @@ test_expect_success 'fix the conflict' '
git add B
'
test_expect_success 'rebase -i -p --root with conflict (second part)' '
test_expect_success REBASE_P 'rebase -i -p --root with conflict (second part)' '
git rebase --continue &&
log_with_names conflict3 >out &&
test_cmp expect-conflict-p out

View File

@ -10,6 +10,11 @@ aren'"'"'t on top of $ONTO, even if they are on top of $UPSTREAM.
'
. ./test-lib.sh
if ! test_have_prereq REBASE_P; then
skip_all='skipping git rebase -p tests, as asked for'
test_done
fi
. "$TEST_DIRECTORY"/lib-rebase.sh
# Set up branches like this:

View File

@ -106,7 +106,7 @@ test_expect_success 'rebase -i --continue handles merge strategy and options' '
test -f funny.was.run
'
test_expect_success 'rebase passes merge strategy options correctly' '
test_expect_success REBASE_P 'rebase passes merge strategy options correctly' '
rm -fr .git/rebase-* &&
git reset --hard commit-new-file-F3-on-topic-branch &&
test_commit theirs-to-merge &&
@ -241,6 +241,6 @@ test_rerere_autoupdate
test_rerere_autoupdate -m
GIT_SEQUENCE_EDITOR=: && export GIT_SEQUENCE_EDITOR
test_rerere_autoupdate -i
test_rerere_autoupdate --preserve-merges
test_have_prereq !REBASE_P || test_rerere_autoupdate --preserve-merges
test_done

View File

@ -29,7 +29,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase success -p
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -43,7 +43,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase success -p
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -59,7 +59,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase failure -p
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase () {
result=$1
@ -73,7 +73,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase success -p
test_have_prereq !REBASE_P || test_run_rebase success -p
# f
# /
@ -113,7 +113,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase failure -m
test_run_rebase success -i
test_run_rebase success -p
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -128,7 +128,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase failure -m
test_run_rebase success -i
test_run_rebase success -p
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -143,7 +143,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase failure -m
test_run_rebase success -i
test_run_rebase success -p
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -158,7 +158,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase success -p
test_have_prereq !REBASE_P || test_run_rebase success -p
# a---b---c---j!
# \
@ -186,7 +186,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase success -p
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -201,7 +201,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase failure -p
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase () {
result=$1
@ -216,7 +216,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase failure -p
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase success --rebase-merges
# m
@ -256,7 +256,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase success -p
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -271,7 +271,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase failure -p
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase () {
result=$1
@ -286,7 +286,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase failure -m
test_run_rebase success -i
test_run_rebase success -p
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -302,7 +302,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase failure -p
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase () {
result=$1
@ -317,7 +317,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase failure -m
test_run_rebase success -i
test_run_rebase failure -p
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase () {
result=$1
@ -331,7 +331,7 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase failure -p
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase () {
result=$1
@ -346,6 +346,6 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_run_rebase success -p
test_have_prereq !REBASE_P || test_run_rebase success -p
test_done

View File

@ -109,6 +109,11 @@ test_run_rebase success 'd e n o' ''
test_run_rebase success 'd e n o' -m
test_run_rebase success 'd n o e' -i
if ! test_have_prereq REBASE_P; then
skip_all='skipping git rebase -p tests, as asked for'
test_done
fi
test_expect_success "rebase -p is no-op in non-linear history" "
reset_rebase &&
git rebase -p d w &&

View File

@ -461,7 +461,8 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '
test file3 = "$(git show HEAD:file3.t)"
'
test_expect_success 'pull.rebase=preserve rebases and merges keep-merge' '
test_expect_success REBASE_P \
'pull.rebase=preserve rebases and merges keep-merge' '
git reset --hard before-preserve-rebase &&
test_config pull.rebase preserve &&
git pull . copy &&
@ -514,7 +515,8 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '
test file3 = "$(git show HEAD:file3.t)"
'
test_expect_success '--rebase=preserve rebases and merges keep-merge' '
test_expect_success REBASE_P \
'--rebase=preserve rebases and merges keep-merge' '
git reset --hard before-preserve-rebase &&
test_config pull.rebase true &&
git pull --rebase=preserve . copy &&

View File

@ -253,7 +253,7 @@ test_rebase () {
}
test_rebase success -i
test_rebase success -p
test_have_prereq !REBASE_P || test_rebase success -p
test_expect_success 'with hook (cherry-pick)' '
test_when_finished "git checkout -f master" &&

View File

@ -72,12 +72,14 @@ test_expect_success 'noop interactive rebase does not care about ident' '
git rebase -i HEAD^
'
test_expect_success 'fast-forward rebase does not care about ident (preserve)' '
test_expect_success REBASE_P \
'fast-forward rebase does not care about ident (preserve)' '
git checkout -B tmp side-without-commit &&
git rebase -p master
'
test_expect_success 'non-fast-forward rebase refuses to write commits (preserve)' '
test_expect_success REBASE_P \
'non-fast-forward rebase refuses to write commits (preserve)' '
test_when_finished "git rebase --abort || true" &&
git checkout -B tmp side-with-commit &&
test_must_fail git rebase -p master

View File

@ -1268,3 +1268,7 @@ test_lazy_prereq CURL '
test_lazy_prereq SHA1 '
test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
'
test_lazy_prereq REBASE_P '
test -z "$GIT_TEST_SKIP_REBASE_P"
'