tests: stop testing git rebase --preserve-merges

This backend has been deprecated in favor of `git rebase
--rebase-merges`.

In preparation for dropping it, let's remove all the regression tests
that would need it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin 2021-09-07 21:05:04 +00:00 committed by Junio C Hamano
parent ab7c7c219b
commit aa4df107e7
17 changed files with 3 additions and 764 deletions

View File

@ -198,7 +198,6 @@ jobs:
shell: bash
env:
NO_SVN_TESTS: 1
GIT_TEST_SKIP_REBASE_P: 1
run: ci/run-test-slice.sh ${{matrix.nr}} 10
- name: ci/print-test-failures.sh
if: failure()

View File

@ -351,82 +351,6 @@ test_expect_success 'retain authorship when squashing' '
git show HEAD | grep "^Author: Twerp Snog"
'
test_expect_success REBASE_P '-p handles "no changes" gracefully' '
HEAD=$(git rev-parse HEAD) &&
git rebase -i -p HEAD^ &&
git update-index --refresh &&
git diff-files --quiet &&
git diff-index --quiet --cached HEAD -- &&
test $HEAD = $(git rev-parse HEAD)
'
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
) &&
test H = $(git cat-file commit HEAD^ | sed -ne \$p) &&
test G = $(git cat-file commit HEAD | sed -ne \$p)
'
test_expect_success REBASE_P 'preserve merges with -p' '
git checkout -b to-be-preserved primary^ &&
: > unrelated-file &&
git add unrelated-file &&
test_tick &&
git commit -m "unrelated" &&
git checkout -b another-branch primary &&
echo B > file1 &&
test_tick &&
git commit -m J file1 &&
test_tick &&
git merge to-be-preserved &&
echo C > file1 &&
test_tick &&
git commit -m K file1 &&
echo D > file1 &&
test_tick &&
git commit -m L1 file1 &&
git checkout HEAD^ &&
echo 1 > unrelated-file &&
test_tick &&
git commit -m L2 unrelated-file &&
test_tick &&
git merge another-branch &&
echo E > file1 &&
test_tick &&
git commit -m M file1 &&
git checkout -b to-be-rebased &&
test_tick &&
git rebase -i -p --onto branch1 primary &&
git update-index --refresh &&
git diff-files --quiet &&
git diff-index --quiet --cached HEAD -- &&
test_cmp_rev HEAD~6 branch1 &&
test_cmp_rev HEAD~4^2 to-be-preserved &&
test_cmp_rev HEAD^^2^ HEAD^^^ &&
test $(git show HEAD~5:file1) = B &&
test $(git show HEAD~3:file1) = C &&
test $(git show HEAD:file1) = E &&
test $(git show HEAD:unrelated-file) = 1
'
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 &&
test_tick &&
git commit -m L2-modified --amend unrelated-file &&
git rebase --continue &&
git update-index --refresh &&
git diff-files --quiet &&
git diff-index --quiet --cached HEAD -- &&
test $(git show HEAD:unrelated-file) = 2
'
test_expect_success '--continue tries to commit' '
git reset --hard D &&
test_tick &&

View File

@ -55,14 +55,4 @@ test_expect_success rebase '
test_cmp expect actual
'
test_expect_success REBASE_P rebasep '
git checkout side-merge &&
git rebase -p side &&
git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
git cat-file commit side-merge-original | sed -e "1,/^\$/d" >expect &&
test_cmp expect actual
'
test_done

View File

@ -1,130 +0,0 @@
#!/bin/sh
#
# Copyright(C) 2008 Stephen Habermann & Andreas Ericsson
#
test_description='git rebase -p should preserve merges
Run "git rebase -p" and check that merges are properly carried along
'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./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
# Clone 2 (conflicting merge):
#
# A1--A2--B3 <-- origin/main
# \ \
# B1------M <-- topic
# \
# B2 <-- origin/topic
#
# Clone 3 (no-ff merge):
#
# A1--A2--B3 <-- origin/main
# \
# B1------M <-- topic
# \ /
# \--A3 <-- topic2
# \
# B2 <-- origin/topic
#
# Clone 4 (same as Clone 3)
test_expect_success 'setup for merge-preserving rebase' \
'echo First > A &&
git add A &&
git commit -m "Add A1" &&
git checkout -b topic &&
echo Second > B &&
git add B &&
git commit -m "Add B1" &&
git checkout -f main &&
echo Third >> A &&
git commit -a -m "Modify A2" &&
echo Fifth > B &&
git add B &&
git commit -m "Add different B" &&
git clone ./. clone2 &&
(
cd clone2 &&
git checkout -b topic origin/topic &&
test_must_fail git merge origin/main &&
echo Resolved >B &&
git add B &&
git commit -m "Merge origin/main into topic"
) &&
git clone ./. clone3 &&
(
cd clone3 &&
git checkout -b topic2 origin/topic &&
echo Sixth > A &&
git commit -a -m "Modify A3" &&
git checkout -b topic origin/topic &&
git merge --no-ff topic2
) &&
git clone ./. clone4 &&
(
cd clone4 &&
git checkout -b topic2 origin/topic &&
echo Sixth > A &&
git commit -a -m "Modify A3" &&
git checkout -b topic origin/topic &&
git merge --no-ff topic2
) &&
git checkout topic &&
echo Fourth >> B &&
git commit -a -m "Modify B2"
'
test_expect_success '--continue works after a conflict' '
(
cd clone2 &&
git fetch &&
test_must_fail git rebase -p origin/topic &&
test 2 = $(git ls-files B | wc -l) &&
echo Resolved again > B &&
test_must_fail git rebase --continue &&
grep "^@@@ " .git/rebase-merge/patch &&
git add B &&
git rebase --continue &&
test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
test 1 = $(git rev-list --all --pretty=oneline | grep "Add different" | wc -l) &&
test 1 = $(git rev-list --all --pretty=oneline | grep "Merge origin" | wc -l)
)
'
test_expect_success 'rebase -p preserves no-ff merges' '
(
cd clone3 &&
git fetch &&
git rebase -p origin/topic &&
test 3 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
test 1 = $(git rev-list --all --pretty=oneline | grep "Merge branch" | wc -l)
)
'
test_expect_success 'rebase -p ignores merge.log config' '
(
cd clone4 &&
git fetch &&
git -c merge.log=1 rebase -p origin/topic &&
echo >expected &&
git log --format="%b" -1 >current &&
test_cmp expected current
)
'
test_done

View File

@ -1,90 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2008 Stephen Haberman
#
test_description='git rebase preserve merges
This test runs git rebase with preserve merges and ensures commits
dropped by the --cherry-pick flag have their childrens parents
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
# \
# F - G - H
# \
# I
#
# where B, D and G touch the same file.
test_expect_success 'setup' '
test_commit A file1 &&
test_commit B file1 1 &&
test_commit C file2 &&
test_commit D file1 2 &&
test_commit E file3 &&
git checkout A &&
test_commit F file4 &&
test_commit G file1 3 &&
test_commit H file5 &&
git checkout F &&
test_commit I file6
'
# A - B - C - D - E
# \ \ \
# F - G - H -- L \ --> L
# \ | \
# I -- G2 -- J -- K I -- K
# G2 = same changes as G
test_expect_success 'skip same-resolution merges with -p' '
git checkout H &&
test_must_fail git merge E &&
test_commit L file1 23 &&
git checkout I &&
test_commit G2 file1 3 &&
test_must_fail git merge E &&
test_commit J file1 23 &&
test_commit K file7 file7 &&
git rebase -i -p L &&
test $(git rev-parse HEAD^^) = $(git rev-parse L) &&
test "23" = "$(cat file1)" &&
test "I" = "$(cat file6)" &&
test "file7" = "$(cat file7)"
'
# A - B - C - D - E
# \ \ \
# F - G - H -- L2 \ --> L2
# \ | \
# I -- G3 --- J2 -- K2 I -- G3 -- K2
# G2 = different changes as G
test_expect_success 'keep different-resolution merges with -p' '
git checkout H &&
test_must_fail git merge E &&
test_commit L2 file1 23 &&
git checkout I &&
test_commit G3 file1 4 &&
test_must_fail git merge E &&
test_commit J2 file1 24 &&
test_commit K2 file7 file7 &&
test_must_fail git rebase -i -p L2 &&
echo 234 > file1 &&
git add file1 &&
git rebase --continue &&
test $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&
test "234" = "$(cat file1)" &&
test "I" = "$(cat file6)" &&
test "file7" = "$(cat file7)"
'
test_done

View File

@ -1,80 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2008 Stephen Haberman
#
test_description='git rebase preserve merges
This test runs git rebase with -p and tries to squash a commit from after
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
# set up two branches like this:
#
# A1 - B1 - D1 - E1 - F1
# \ /
# -- C1 --
test_expect_success 'setup' '
test_commit A1 &&
test_commit B1 &&
test_commit C1 &&
git reset --hard B1 &&
test_commit D1 &&
test_merge E1 C1 &&
test_commit F1
'
# Should result in:
#
# A1 - B1 - D2 - E2
# \ /
# -- C1 --
#
test_expect_success 'squash F1 into D1' '
FAKE_LINES="1 squash 4 2 3" git rebase -i -p B1 &&
test "$(git rev-parse HEAD^2)" = "$(git rev-parse C1)" &&
test "$(git rev-parse HEAD~2)" = "$(git rev-parse B1)" &&
git tag E2
'
# Start with:
#
# A1 - B1 - D2 - E2
# \
# G1 ---- L1 ---- M1
# \ /
# H1 -- J1 -- K1
# \ /
# -- I1 --
#
# And rebase G1..M1 onto E2
test_expect_success 'rebase two levels of merge' '
git checkout A1 &&
test_commit G1 &&
test_commit H1 &&
test_commit I1 &&
git checkout -b branch3 H1 &&
test_commit J1 &&
test_merge K1 I1 &&
git checkout -b branch2 G1 &&
test_commit L1 &&
test_merge M1 K1 &&
GIT_EDITOR=: git rebase -i -p E2 &&
test "$(git rev-parse HEAD~3)" = "$(git rev-parse E2)" &&
test "$(git rev-parse HEAD~2)" = "$(git rev-parse HEAD^2^2~2)" &&
test "$(git rev-parse HEAD^2^1^1)" = "$(git rev-parse HEAD^2^2^1)"
'
test_done

View File

@ -89,17 +89,6 @@ test_expect_success 'pre-rebase got correct input (4)' '
test "z$(cat .git/PRE-REBASE-INPUT)" = z--root,work4
'
test_expect_success REBASE_P 'rebase -i -p with linear history' '
git checkout -b work5 other &&
git rebase -i -p --root --onto main &&
git log --pretty=tformat:"%s" > rebased5 &&
test_cmp expect rebased5
'
test_expect_success REBASE_P 'pre-rebase got correct input (5)' '
test "z$(cat .git/PRE-REBASE-INPUT)" = z--root,
'
test_expect_success 'set up merge history' '
git checkout other^ &&
git checkout -b side &&
@ -123,13 +112,6 @@ commit work6~4
1
EOF
test_expect_success REBASE_P 'rebase -i -p with merge' '
git checkout -b work6 other &&
git rebase -i -p --root --onto main &&
log_with_names work6 > rebased6 &&
test_cmp expect-side rebased6
'
test_expect_success 'set up second root and merge' '
git symbolic-ref HEAD refs/heads/third &&
rm .git/index &&
@ -158,13 +140,6 @@ commit work7~5
1
EOF
test_expect_success REBASE_P 'rebase -i -p with two roots' '
git checkout -b work7 other &&
git rebase -i -p --root --onto main &&
log_with_names work7 > rebased7 &&
test_cmp expect-third rebased7
'
test_expect_success 'setup pre-rebase hook that fails' '
mkdir -p .git/hooks &&
cat >.git/hooks/pre-rebase <<EOF &&
@ -264,21 +239,9 @@ commit conflict3~6
1
EOF
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 main &&
git ls-files -u | grep "B$"
'
test_expect_success 'fix the conflict' '
echo 3 > B &&
git add B
'
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
'
test_done

View File

@ -1,85 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2009 Greg Price
#
test_description='git rebase -p should respect --onto
In a rebase with --onto, we should rewrite all the commits that
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:
# A1---B1---E1---F1---G1
# \ \ /
# \ \--C1---D1--/
# H1
test_expect_success 'setup' '
test_commit A1 &&
test_commit B1 &&
test_commit C1 &&
test_commit D1 &&
git reset --hard B1 &&
test_commit E1 &&
test_commit F1 &&
test_merge G1 D1 &&
git reset --hard A1 &&
test_commit H1
'
# Now rebase merge G1 from both branches' base B1, both should move:
# A1---B1---E1---F1---G1
# \ \ /
# \ \--C1---D1--/
# \
# H1---E2---F2---G2
# \ /
# \--C2---D2--/
test_expect_success 'rebase from B1 onto H1' '
git checkout G1 &&
git rebase -p --onto H1 B1 &&
test "$(git rev-parse HEAD^1^1^1)" = "$(git rev-parse H1)" &&
test "$(git rev-parse HEAD^2^1^1)" = "$(git rev-parse H1)"
'
# On the other hand if rebase from E1 which is within one branch,
# then the other branch stays:
# A1---B1---E1---F1---G1
# \ \ /
# \ \--C1---D1--/
# \ \
# H1-----F3-----G3
test_expect_success 'rebase from E1 onto H1' '
git checkout G1 &&
git rebase -p --onto H1 E1 &&
test "$(git rev-parse HEAD^1^1)" = "$(git rev-parse H1)" &&
test "$(git rev-parse HEAD^2)" = "$(git rev-parse D1)"
'
# And the same if we rebase from a commit in the second-parent branch.
# A1---B1---E1---F1----G1
# \ \ \ /
# \ \--C1---D1-\-/
# \ \
# H1------D3------G4
test_expect_success 'rebase from C1 onto H1' '
git checkout G1 &&
git rev-list --first-parent --pretty=oneline C1..G1 &&
git rebase -p --onto H1 C1 &&
test "$(git rev-parse HEAD^2^1)" = "$(git rev-parse H1)" &&
test "$(git rev-parse HEAD^1)" = "$(git rev-parse F1)"
'
test_done

View File

@ -109,20 +109,6 @@ test_expect_success 'rebase -i --continue handles merge strategy and options' '
test -f funny.was.run
'
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 &&
git reset --hard HEAD^ &&
test_commit some-commit &&
test_tick &&
git merge --no-ff theirs-to-merge &&
FAKE_LINES="1 edit 2 3" git rebase -i -f -p -m \
-s recursive --strategy-option=theirs HEAD~2 &&
test_commit force-change &&
git rebase --continue
'
test_expect_success 'rebase -r passes merge strategy options correctly' '
rm -fr .git/rebase-* &&
git reset --hard commit-new-file-F3-on-topic-branch &&
@ -258,7 +244,6 @@ test_rerere_autoupdate
test_rerere_autoupdate -m
GIT_SEQUENCE_EDITOR=: && export GIT_SEQUENCE_EDITOR
test_rerere_autoupdate -i
test_have_prereq !REBASE_P || test_rerere_autoupdate --preserve-merges
unset GIT_SEQUENCE_EDITOR
test_expect_success 'the todo command "break" works' '

View File

@ -29,7 +29,6 @@ test_run_rebase () {
test_run_rebase success --apply
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
test_expect_success 'setup branches and remote tracking' '
git tag -l >tags &&
@ -53,7 +52,6 @@ test_run_rebase () {
test_run_rebase success --apply
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -70,7 +68,6 @@ test_run_rebase success --apply
test_run_rebase success --fork-point
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase () {
result=$1
@ -87,7 +84,6 @@ test_run_rebase success --apply
test_run_rebase success --fork-point
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -102,7 +98,6 @@ test_run_rebase success --apply
test_run_rebase success --fork-point
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
# f
# /
@ -142,7 +137,6 @@ test_run_rebase () {
test_run_rebase success --apply
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -157,7 +151,6 @@ test_run_rebase () {
test_run_rebase success --apply
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -172,7 +165,6 @@ test_run_rebase () {
test_run_rebase success --apply
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -187,7 +179,6 @@ test_run_rebase () {
test_run_rebase success --apply
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
# a---b---c---j!
# \
@ -215,7 +206,6 @@ test_run_rebase () {
test_run_rebase failure --apply
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase () {
result=$1
@ -229,7 +219,6 @@ test_run_rebase () {
}
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -243,7 +232,6 @@ test_run_rebase () {
}
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase success --rebase-merges
# m
@ -283,7 +271,6 @@ test_run_rebase () {
test_run_rebase success --apply
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -298,7 +285,6 @@ test_run_rebase () {
test_run_rebase success --apply
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase () {
result=$1
@ -313,7 +299,6 @@ test_run_rebase () {
test_run_rebase success --apply
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
test_run_rebase () {
result=$1
@ -329,7 +314,6 @@ test_run_rebase () {
test_run_rebase success --apply
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase () {
result=$1
@ -344,7 +328,6 @@ test_run_rebase () {
test_run_rebase success --apply
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase () {
result=$1
@ -358,7 +341,6 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase failure -p
test_run_rebase () {
result=$1
@ -373,6 +355,5 @@ test_run_rebase () {
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p
test_done

View File

@ -63,15 +63,4 @@ test_rebase_am_only () {
test_rebase_am_only --whitespace=fix
test_rebase_am_only -C4
test_expect_success REBASE_P '--preserve-merges incompatible with --signoff' '
git checkout B^0 &&
test_must_fail git rebase --preserve-merges --signoff A
'
test_expect_success REBASE_P \
'--preserve-merges incompatible with --rebase-merges' '
git checkout B^0 &&
test_must_fail git rebase --preserve-merges --rebase-merges A
'
test_done

View File

@ -106,155 +106,4 @@ test_run_rebase success 'd n o e' --apply
test_run_rebase success 'd n o e' -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 &&
test_cmp_rev w HEAD
"
test_expect_success "rebase -p is no-op when base inside second parent" "
reset_rebase &&
git rebase -p e w &&
test_cmp_rev w HEAD
"
test_expect_failure "rebase -p --root on non-linear history is a no-op" "
reset_rebase &&
git rebase -p --root w &&
test_cmp_rev w HEAD
"
test_expect_success "rebase -p re-creates merge from side branch" "
reset_rebase &&
git rebase -p z w &&
test_cmp_rev z HEAD^ &&
test_cmp_rev w^2 HEAD^2
"
test_expect_success "rebase -p re-creates internal merge" "
reset_rebase &&
git rebase -p c w &&
test_cmp_rev c HEAD~4 &&
test_cmp_rev HEAD^2^ HEAD~3 &&
test_revision_subjects 'd n e o w' HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD
"
test_expect_success "rebase -p can re-create two branches on onto" "
reset_rebase &&
git rebase -p --onto c d w &&
test_cmp_rev c HEAD~3 &&
test_cmp_rev c HEAD^2^ &&
test_revision_subjects 'n e o w' HEAD~2 HEAD^2 HEAD^ HEAD
"
# f
# /
# a---b---c---g---h
# \
# d---gp--i
# \ \
# e-------u
#
# gp = cherry-picked g
# h = reverted g
test_expect_success 'setup of non-linear-history for patch-equivalence tests' '
git checkout e &&
test_merge u i
'
test_expect_success "rebase -p re-creates history around dropped commit matching upstream" "
reset_rebase &&
git rebase -p h u &&
test_cmp_rev h HEAD~3 &&
test_cmp_rev HEAD^2^ HEAD~2 &&
test_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD
"
test_expect_success "rebase -p --onto in merged history drops patches in upstream" "
reset_rebase &&
git rebase -p --onto f h u &&
test_cmp_rev f HEAD~3 &&
test_cmp_rev HEAD^2^ HEAD~2 &&
test_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD
"
test_expect_success "rebase -p --onto in merged history does not drop patches in onto" "
reset_rebase &&
git rebase -p --onto h f u &&
test_cmp_rev h HEAD~3 &&
test_cmp_rev HEAD^2~2 HEAD~2 &&
test_revision_subjects 'd gp i e u' HEAD~2 HEAD^2^ HEAD^2 HEAD^ HEAD
"
# a---b---c---g---h
# \
# d---gp--s
# \ \ /
# \ X
# \ / \
# e---t
#
# gp = cherry-picked g
# h = reverted g
test_expect_success 'setup of non-linear-history for dropping whole side' '
git checkout gp &&
test_merge s e &&
git checkout e &&
test_merge t gp
'
test_expect_failure "rebase -p drops merge commit when entire first-parent side is dropped" "
reset_rebase &&
git rebase -p h s &&
test_cmp_rev h HEAD~2 &&
test_linear_range 'd e' h..
"
test_expect_success "rebase -p drops merge commit when entire second-parent side is dropped" "
reset_rebase &&
git rebase -p h t &&
test_cmp_rev h HEAD~2 &&
test_linear_range 'd e' h..
"
# a---b---c
# \
# d---e
# \ \
# n---r
# \
# o
#
# r = tree-same with n
test_expect_success 'setup of non-linear-history for empty commits' '
git checkout n &&
git merge --no-commit e &&
git reset n . &&
git commit -m r &&
git reset --hard &&
git clean -f &&
git tag r
'
test_expect_success "rebase -p re-creates empty internal merge commit" "
reset_rebase &&
git rebase -p c r &&
test_cmp_rev c HEAD~3 &&
test_cmp_rev HEAD^2^ HEAD~2 &&
test_revision_subjects 'd e n r' HEAD~2 HEAD^2 HEAD^ HEAD
"
test_expect_success "rebase -p re-creates empty merge commit" "
reset_rebase &&
git rebase -p o r &&
test_cmp_rev e HEAD^2 &&
test_cmp_rev o HEAD^ &&
test_revision_subjects 'r' HEAD
"
test_done

View File

@ -36,11 +36,10 @@ commit_message() {
# where the root commit adds three files: topic_1.t, topic_2.t and topic_3.t.
#
# This commit history is then rebased onto `topic_3` with the
# `-Xsubtree=files_subtree` option in three different ways:
# `-Xsubtree=files_subtree` option in two different ways:
#
# 1. using `--preserve-merges`
# 2. using `--preserve-merges` and --keep-empty
# 3. without specifying a rebase backend
# 1. without specifying a rebase backend
# 2. using the `--rebase-merges` backend
test_expect_success 'setup' '
test_commit README &&
@ -69,25 +68,6 @@ test_expect_success 'setup' '
git commit -m "Empty commit" --allow-empty
'
# FAILURE: Does not preserve topic_4.
test_expect_failure REBASE_P 'Rebase -Xsubtree --preserve-merges --onto commit' '
reset_rebase &&
git checkout -b rebase-preserve-merges to-rebase &&
git rebase -Xsubtree=files_subtree --preserve-merges --onto files-main main &&
verbose test "$(commit_message HEAD~)" = "topic_4" &&
verbose test "$(commit_message HEAD)" = "files_subtree/topic_5"
'
# FAILURE: Does not preserve topic_4.
test_expect_failure REBASE_P 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit' '
reset_rebase &&
git checkout -b rebase-keep-empty to-rebase &&
git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-main main &&
verbose test "$(commit_message HEAD~2)" = "topic_4" &&
verbose test "$(commit_message HEAD~)" = "files_subtree/topic_5" &&
verbose test "$(commit_message HEAD)" = "Empty commit"
'
test_expect_success 'Rebase -Xsubtree --empty=ask --onto commit' '
reset_rebase &&
git checkout -b rebase-onto to-rebase &&

View File

@ -546,15 +546,6 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '
test_cmp expect actual
'
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 &&
test_cmp_rev HEAD^^ copy &&
test_cmp_rev HEAD^2 keep-merge
'
test_expect_success 'pull.rebase=interactive' '
write_script "$TRASH_DIRECTORY/fake-editor" <<-\EOF &&
echo I was here >fake.out &&
@ -606,15 +597,6 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '
test_cmp expect actual
'
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 &&
test_cmp_rev HEAD^^ copy &&
test_cmp_rev HEAD^2 keep-merge
'
test_expect_success '--rebase=invalid fails' '
git reset --hard before-preserve-rebase &&
test_must_fail git pull --rebase=invalid . copy

View File

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

View File

@ -75,19 +75,6 @@ test_expect_success 'noop interactive rebase does not care about ident' '
git rebase -i HEAD^
'
test_expect_success REBASE_P \
'fast-forward rebase does not care about ident (preserve)' '
git checkout -B tmp side-without-commit &&
git rebase -p main
'
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 main
'
test_expect_success 'author.name overrides user.name' '
test_config user.name user &&
test_config user.email user@example.com &&

View File

@ -1708,10 +1708,6 @@ test_lazy_prereq SHA1 '
esac
'
test_lazy_prereq REBASE_P '
test -z "$GIT_TEST_SKIP_REBASE_P"
'
# Ensure that no test accidentally triggers a Git command
# that runs the actual maintenance scheduler, affecting a user's
# system permanently.