mirror of
https://github.com/git/git.git
synced 2024-11-28 12:34:08 +08:00
10cdb9f38a
Two related changes, with separate rationale for each: Rename the 'interactive' backend to 'merge' because: * 'interactive' as a name caused confusion; this backend has been used for many kinds of non-interactive rebases, and will probably be used in the future for more non-interactive rebases than interactive ones given that we are making it the default. * 'interactive' is not the underlying strategy; merging is. * the directory where state is stored is not called .git/rebase-interactive but .git/rebase-merge. Rename the 'am' backend to 'apply' because: * Few users are familiar with git-am as a reference point. * Related to the above, the name 'am' makes sentences in the documentation harder for users to read and comprehend (they may read it as the verb from "I am"); avoiding this difficult places a large burden on anyone writing documentation about this backend to be very careful with quoting and sentence structure and often forces annoying redundancy to try to avoid such problems. * Users stumble over pronunciation ("am" as in "I am a person not a backend" or "am" as in "the first and thirteenth letters in the alphabet in order are "A-M"); this may drive confusion when one user tries to explain to another what they are doing. * While "am" is the tool driving this backend, the tool driving git-am is git-apply, and since we are driving towards lower-level tools for the naming of the merge backend we may as well do so here too. * The directory where state is stored has never been called .git/rebase-am, it was always called .git/rebase-apply. For all the reasons listed above: * Modify the documentation to refer to the backends with the new names * Provide a brief note in the documentation connecting the new names to the old names in case users run across the old names anywhere (e.g. in old release notes or older versions of the documentation) * Change the (new) --am command line flag to --apply * Rename some enums, variables, and functions to reinforce the new backend names for us as well. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
124 lines
4.5 KiB
Bash
Executable File
124 lines
4.5 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Copyright (c) 2019 Denton Liu
|
|
#
|
|
|
|
test_description='ensure rebase fast-forwards commits when possible'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success setup '
|
|
test_commit A &&
|
|
test_commit B &&
|
|
test_commit C &&
|
|
test_commit D &&
|
|
git checkout -t -b side
|
|
'
|
|
|
|
test_rebase_same_head () {
|
|
status_n="$1" &&
|
|
shift &&
|
|
what_n="$1" &&
|
|
shift &&
|
|
cmp_n="$1" &&
|
|
shift &&
|
|
status_f="$1" &&
|
|
shift &&
|
|
what_f="$1" &&
|
|
shift &&
|
|
cmp_f="$1" &&
|
|
shift &&
|
|
test_rebase_same_head_ $status_n $what_n $cmp_n " --apply" "$*" &&
|
|
test_rebase_same_head_ $status_f $what_f $cmp_f " --apply --no-ff" "$*"
|
|
test_rebase_same_head_ $status_n $what_n $cmp_n " --merge" "$*" &&
|
|
test_rebase_same_head_ $status_f $what_f $cmp_f " --merge --no-ff" "$*"
|
|
}
|
|
|
|
test_rebase_same_head_ () {
|
|
status="$1" &&
|
|
shift &&
|
|
what="$1" &&
|
|
shift &&
|
|
cmp="$1" &&
|
|
shift &&
|
|
flag="$1"
|
|
shift &&
|
|
test_expect_$status "git rebase$flag $* with $changes is $what with $cmp HEAD" "
|
|
oldhead=\$(git rev-parse HEAD) &&
|
|
test_when_finished 'git reset --hard \$oldhead' &&
|
|
cp .git/logs/HEAD expect &&
|
|
git rebase$flag $* >stdout &&
|
|
if test $what = work
|
|
then
|
|
old=\$(wc -l <expect) &&
|
|
test_line_count '-gt' \$old .git/logs/HEAD
|
|
elif test $what = noop
|
|
then
|
|
test_cmp expect .git/logs/HEAD
|
|
fi &&
|
|
newhead=\$(git rev-parse HEAD) &&
|
|
if test $cmp = same
|
|
then
|
|
test_cmp_rev \$oldhead \$newhead
|
|
elif test $cmp = diff
|
|
then
|
|
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 work same 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 same --onto master... master
|
|
test_rebase_same_head success noop same success work same --keep-base master
|
|
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 master
|
|
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_expect_success 'add work same to side' '
|
|
test_commit E
|
|
'
|
|
|
|
changes='our changes'
|
|
test_rebase_same_head success noop same success work same
|
|
test_rebase_same_head success noop same success work same 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 same --onto master... master
|
|
test_rebase_same_head success noop same success work same --keep-base master
|
|
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 master
|
|
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_expect_success 'add work same to upstream' '
|
|
git checkout master &&
|
|
test_commit F &&
|
|
git checkout side
|
|
'
|
|
|
|
changes='our and their changes'
|
|
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 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 --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_done
|