summaryrefslogtreecommitdiff
path: root/t/t3432-rebase-fast-forward.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t3432-rebase-fast-forward.sh')
-rwxr-xr-xt/t3432-rebase-fast-forward.sh98
1 files changed, 57 insertions, 41 deletions
diff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh
index 034ffc7e76..5086e14c02 100755
--- a/t/t3432-rebase-fast-forward.sh
+++ b/t/t3432-rebase-fast-forward.sh
@@ -5,6 +5,9 @@
test_description='ensure rebase fast-forwards commits when possible'
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
. ./test-lib.sh
test_expect_success setup '
@@ -28,8 +31,12 @@ test_rebase_same_head () {
shift &&
cmp_f="$1" &&
shift &&
- test_rebase_same_head_ $status_n $what_n $cmp_n "" "$*" &&
- test_rebase_same_head_ $status_f $what_f $cmp_f " --no-ff" "$*"
+ test_rebase_same_head_ $status_n $what_n $cmp_n 0 " --apply" "$*" &&
+ test_rebase_same_head_ $status_f $what_f $cmp_f 0 " --apply --no-ff" "$*"
+ test_rebase_same_head_ $status_n $what_n $cmp_n 0 " --merge" "$*" &&
+ test_rebase_same_head_ $status_f $what_f $cmp_f 0 " --merge --no-ff" "$*"
+ test_rebase_same_head_ $status_n $what_n $cmp_n 1 " --merge" "$*" &&
+ test_rebase_same_head_ $status_f $what_f $cmp_f 1 " --merge --no-ff" "$*"
}
test_rebase_same_head_ () {
@@ -39,24 +46,33 @@ test_rebase_same_head_ () {
shift &&
cmp="$1" &&
shift &&
+ abbreviate="$1" &&
+ shift &&
flag="$1"
shift &&
- test_expect_$status "git rebase$flag $* with $changes is $what with $cmp HEAD" "
+ if test $abbreviate -eq 1
+ then
+ msg="git rebase$flag $* (rebase.abbreviateCommands = true) with $changes is $what with $cmp HEAD"
+ else
+ msg="git rebase$flag $* with $changes is $what with $cmp HEAD"
+ fi &&
+ test_expect_$status "$msg" "
+ if test $abbreviate -eq 1
+ then
+ test_config rebase.abbreviateCommands true
+ fi &&
oldhead=\$(git rev-parse HEAD) &&
test_when_finished 'git reset --hard \$oldhead' &&
+ git reflog HEAD >expect &&
git rebase$flag $* >stdout &&
+ git reflog HEAD >actual &&
if test $what = work
then
- # Must check this case first, for 'is up to
- # date, rebase forced[...]rewinding head' cases
- test_i18ngrep 'rewinding head' stdout
+ old=\$(wc -l <expect) &&
+ test_line_count '-gt' \$old actual
elif test $what = noop
then
- test_i18ngrep 'is up to date' stdout &&
- test_i18ngrep ! 'rebase forced' stdout
- elif test $what = noop-force
- then
- test_i18ngrep 'is up to date, rebase forced' stdout
+ test_cmp expect actual
fi &&
newhead=\$(git rev-parse HEAD) &&
if test $cmp = same
@@ -64,26 +80,26 @@ test_rebase_same_head_ () {
test_cmp_rev \$oldhead \$newhead
elif test $cmp = diff
then
- ! test_cmp_rev \$oldhead \$newhead
+ test_cmp_rev ! \$oldhead \$newhead
fi
"
}
changes='no changes'
test_rebase_same_head success noop same success work same
-test_rebase_same_head success noop same success noop-force same master
-test_rebase_same_head success noop same success noop-force diff --onto B B
-test_rebase_same_head success noop same success noop-force diff --onto B... B
-test_rebase_same_head success noop same success noop-force same --onto master... master
-test_rebase_same_head success noop same success noop-force same --keep-base master
-test_rebase_same_head success noop same success noop-force same --keep-base
-test_rebase_same_head success noop same success noop-force same --no-fork-point
-test_rebase_same_head success noop same success noop-force same --keep-base --no-fork-point
-test_rebase_same_head success noop same success work same --fork-point master
+test_rebase_same_head success noop same success work same main
+test_rebase_same_head success noop same success work diff --onto B B
+test_rebase_same_head success noop same success work diff --onto B... B
+test_rebase_same_head success noop same success work same --onto main... main
+test_rebase_same_head success noop same success work same --keep-base main
+test_rebase_same_head success noop same success work same --keep-base
+test_rebase_same_head success noop same success work same --no-fork-point
+test_rebase_same_head success noop same success work same --keep-base --no-fork-point
+test_rebase_same_head success noop same success work same --fork-point main
test_rebase_same_head success noop same success work diff --fork-point --onto B B
test_rebase_same_head success noop same success work diff --fork-point --onto B... B
-test_rebase_same_head success noop same success work same --fork-point --onto master... master
-test_rebase_same_head success noop same success work same --keep-base --keep-base master
+test_rebase_same_head success noop same success work same --fork-point --onto main... main
+test_rebase_same_head success noop same success work same --keep-base --keep-base main
test_expect_success 'add work same to side' '
test_commit E
@@ -91,35 +107,35 @@ test_expect_success 'add work same to side' '
changes='our changes'
test_rebase_same_head success noop same success work same
-test_rebase_same_head success noop same success noop-force same master
-test_rebase_same_head success noop same success noop-force diff --onto B B
-test_rebase_same_head success noop same success noop-force diff --onto B... B
-test_rebase_same_head success noop same success noop-force same --onto master... master
-test_rebase_same_head success noop same success noop-force same --keep-base master
-test_rebase_same_head success noop same success noop-force same --keep-base
-test_rebase_same_head success noop same success noop-force same --no-fork-point
-test_rebase_same_head success noop same success noop-force same --keep-base --no-fork-point
-test_rebase_same_head success noop same success work same --fork-point master
+test_rebase_same_head success noop same success work same main
+test_rebase_same_head success noop same success work diff --onto B B
+test_rebase_same_head success noop same success work diff --onto B... B
+test_rebase_same_head success noop same success work same --onto main... main
+test_rebase_same_head success noop same success work same --keep-base main
+test_rebase_same_head success noop same success work same --keep-base
+test_rebase_same_head success noop same success work same --no-fork-point
+test_rebase_same_head success noop same success work same --keep-base --no-fork-point
+test_rebase_same_head success noop same success work same --fork-point main
test_rebase_same_head success noop same success work diff --fork-point --onto B B
test_rebase_same_head success noop same success work diff --fork-point --onto B... B
-test_rebase_same_head success noop same success work same --fork-point --onto master... master
-test_rebase_same_head success noop same success work same --fork-point --keep-base master
+test_rebase_same_head success noop same success work same --fork-point --onto main... main
+test_rebase_same_head success noop same success work same --fork-point --keep-base main
test_expect_success 'add work same to upstream' '
- git checkout master &&
+ git checkout main &&
test_commit F &&
git checkout side
'
changes='our and their changes'
-test_rebase_same_head success noop same success noop-force diff --onto B B
-test_rebase_same_head success noop same success noop-force diff --onto B... B
-test_rebase_same_head success noop same success work diff --onto master... master
-test_rebase_same_head success noop same success work diff --keep-base master
+test_rebase_same_head success noop same success work diff --onto B B
+test_rebase_same_head success noop same success work diff --onto B... B
+test_rebase_same_head success noop same success work diff --onto main... main
+test_rebase_same_head success noop same success work diff --keep-base main
test_rebase_same_head success noop same success work diff --keep-base
test_rebase_same_head failure work same success work diff --fork-point --onto B B
test_rebase_same_head failure work same success work diff --fork-point --onto B... B
-test_rebase_same_head success noop same success work diff --fork-point --onto master... master
-test_rebase_same_head success noop same success work diff --fork-point --keep-base master
+test_rebase_same_head success noop same success work diff --fork-point --onto main... main
+test_rebase_same_head success noop same success work diff --fork-point --keep-base main
test_done