Browse Source

t7[5-9]*: adjust the references to the default branch name "main"

Excluding t7817, which is added in an unrelated patch series at the time
of writing, this adjusts t7[5-9]*. This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t7[5-9]*.sh)

This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main`
for those tests.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Johannes Schindelin 4 years ago committed by Junio C Hamano
parent
commit
1e2ae142c0
  1. 4
      t/t7501-commit-basic-functionality.sh
  2. 14
      t/t7502-commit-porcelain.sh
  3. 44
      t/t7503-pre-commit-and-pre-merge-commit-hooks.sh
  4. 26
      t/t7504-commit-msg-hook.sh
  5. 22
      t/t7505-prepare-commit-msg-hook.sh
  6. 58
      t/t7508-status.sh
  7. 4
      t/t7510-signed-commit.sh
  8. 42
      t/t7512-status-help.sh
  9. 14
      t/t7517-per-repo-email.sh
  10. 46
      t/t7600-merge.sh
  11. 2
      t/t7606-merge-custom.sh
  12. 38
      t/t7608-merge-messages.sh
  13. 176
      t/t7610-mergetool.sh
  14. 6
      t/t7611-merge-abort.sh
  15. 4
      t/t7612-merge-verify-signatures.sh
  16. 26
      t/t7614-merge-signoff.sh
  17. 4
      t/t7701-repack-unpack-unreachable.sh
  18. 40
      t/t7800-difftool.sh
  19. 30
      t/t7810-grep.sh

4
t/t7501-commit-basic-functionality.sh

@ -7,7 +7,7 @@
# signoff # signoff


test_description='git commit' test_description='git commit'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -606,7 +606,7 @@ test_expect_success 'same tree (merge and amend merge)' '
echo zero >zero && echo zero >zero &&
git add zero && git add zero &&
git commit -m "add zero" && git commit -m "add zero" &&
git checkout master && git checkout main &&


git merge -s ours side -m "empty ok" && git merge -s ours side -m "empty ok" &&
git diff HEAD^ HEAD >actual && git diff HEAD^ HEAD >actual &&

14
t/t7502-commit-porcelain.sh

@ -2,7 +2,7 @@


test_description='git commit porcelain-ish' test_description='git commit porcelain-ish'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -79,7 +79,7 @@ test_expect_success 'output summary format for merges' '


output_tests_cleanup() { output_tests_cleanup() {
# this is needed for "do not fire editor in the presence of conflicts" # this is needed for "do not fire editor in the presence of conflicts"
git checkout master && git checkout main &&


# this is needed for the "partial removal" test to pass # this is needed for the "partial removal" test to pass
git rm file1 && git rm file1 &&
@ -443,7 +443,7 @@ test_expect_success 'do not fire editor in the presence of conflicts' '
git add g && git add g &&
git commit -m "add g" && git commit -m "add g" &&
git branch second && git branch second &&
echo master >g && echo main >g &&
echo g >h && echo g >h &&
git add g h && git add g h &&
git commit -m "modify g and add h" && git commit -m "modify g and add h" &&
@ -452,7 +452,7 @@ test_expect_success 'do not fire editor in the presence of conflicts' '
git add g && git add g &&
git commit -m second && git commit -m second &&
# Must fail due to conflict # Must fail due to conflict
test_must_fail git cherry-pick -n master && test_must_fail git cherry-pick -n main &&
echo "editor not started" >.git/result && echo "editor not started" >.git/result &&
( (
GIT_EDITOR="\"$(pwd)/.git/FAKE_EDITOR\"" && GIT_EDITOR="\"$(pwd)/.git/FAKE_EDITOR\"" &&
@ -481,9 +481,9 @@ git reset -q --hard


test_expect_success 'Hand committing of a redundant merge removes dups' ' test_expect_success 'Hand committing of a redundant merge removes dups' '


git rev-parse second master >expect && git rev-parse second main >expect &&
test_must_fail git merge second master && test_must_fail git merge second main &&
git checkout master g && git checkout main g &&
EDITOR=: git commit -a && EDITOR=: git commit -a &&
git cat-file commit HEAD >raw && git cat-file commit HEAD >raw &&
sed -n -e "s/^parent //p" -e "/^$/q" raw >actual && sed -n -e "s/^parent //p" -e "/^$/q" raw >actual &&

44
t/t7503-pre-commit-and-pre-merge-commit-hooks.sh

@ -2,7 +2,7 @@


test_description='pre-commit and pre-merge-commit hooks' test_description='pre-commit and pre-merge-commit hooks'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -47,16 +47,16 @@ test_expect_success 'root commit' '
git add foo && git add foo &&
git commit -m "make it non-ff" && git commit -m "make it non-ff" &&
git branch side-orig side && git branch side-orig side &&
git checkout master git checkout main
' '


test_expect_success 'setup conflicting branches' ' test_expect_success 'setup conflicting branches' '
test_when_finished "git checkout master" && test_when_finished "git checkout main" &&
git checkout -b conflicting-a master && git checkout -b conflicting-a main &&
echo a >conflicting && echo a >conflicting &&
git add conflicting && git add conflicting &&
git commit -m conflicting-a && git commit -m conflicting-a &&
git checkout -b conflicting-b master && git checkout -b conflicting-b main &&
echo b >conflicting && echo b >conflicting &&
git add conflicting && git add conflicting &&
git commit -m conflicting-b git commit -m conflicting-b
@ -74,8 +74,8 @@ test_expect_success 'with no hook (merge)' '
test_when_finished "rm -f actual_hooks" && test_when_finished "rm -f actual_hooks" &&
git branch -f side side-orig && git branch -f side side-orig &&
git checkout side && git checkout side &&
git merge -m "merge master" master && git merge -m "merge main" main &&
git checkout master && git checkout main &&
test_path_is_missing actual_hooks test_path_is_missing actual_hooks
' '


@ -91,8 +91,8 @@ test_expect_success '--no-verify with no hook (merge)' '
test_when_finished "rm -f actual_hooks" && test_when_finished "rm -f actual_hooks" &&
git branch -f side side-orig && git branch -f side side-orig &&
git checkout side && git checkout side &&
git merge --no-verify -m "merge master" master && git merge --no-verify -m "merge main" main &&
git checkout master && git checkout main &&
test_path_is_missing actual_hooks test_path_is_missing actual_hooks
' '


@ -111,15 +111,15 @@ test_expect_success 'with succeeding hook (merge)' '
cp "$HOOKDIR/success.sample" "$PREMERGE" && cp "$HOOKDIR/success.sample" "$PREMERGE" &&
echo "$PREMERGE" >expected_hooks && echo "$PREMERGE" >expected_hooks &&
git checkout side && git checkout side &&
git merge -m "merge master" master && git merge -m "merge main" main &&
git checkout master && git checkout main &&
test_cmp expected_hooks actual_hooks test_cmp expected_hooks actual_hooks
' '


test_expect_success 'automatic merge fails; both hooks are available' ' test_expect_success 'automatic merge fails; both hooks are available' '
test_when_finished "rm -f \"$PREMERGE\" \"$PRECOMMIT\"" && test_when_finished "rm -f \"$PREMERGE\" \"$PRECOMMIT\"" &&
test_when_finished "rm -f expected_hooks actual_hooks" && test_when_finished "rm -f expected_hooks actual_hooks" &&
test_when_finished "git checkout master" && test_when_finished "git checkout main" &&
cp "$HOOKDIR/success.sample" "$PREMERGE" && cp "$HOOKDIR/success.sample" "$PREMERGE" &&
cp "$HOOKDIR/success.sample" "$PRECOMMIT" && cp "$HOOKDIR/success.sample" "$PRECOMMIT" &&


@ -148,8 +148,8 @@ test_expect_success '--no-verify with succeeding hook (merge)' '
cp "$HOOKDIR/success.sample" "$PREMERGE" && cp "$HOOKDIR/success.sample" "$PREMERGE" &&
git branch -f side side-orig && git branch -f side side-orig &&
git checkout side && git checkout side &&
git merge --no-verify -m "merge master" master && git merge --no-verify -m "merge main" main &&
git checkout master && git checkout main &&
test_path_is_missing actual_hooks test_path_is_missing actual_hooks
' '


@ -177,8 +177,8 @@ test_expect_success 'with failing hook (merge)' '
cp "$HOOKDIR/fail.sample" "$PREMERGE" && cp "$HOOKDIR/fail.sample" "$PREMERGE" &&
echo "$PREMERGE" >expected_hooks && echo "$PREMERGE" >expected_hooks &&
git checkout side && git checkout side &&
test_must_fail git merge -m "merge master" master && test_must_fail git merge -m "merge main" main &&
git checkout master && git checkout main &&
test_cmp expected_hooks actual_hooks test_cmp expected_hooks actual_hooks
' '


@ -187,8 +187,8 @@ test_expect_success '--no-verify with failing hook (merge)' '
cp "$HOOKDIR/fail.sample" "$PREMERGE" && cp "$HOOKDIR/fail.sample" "$PREMERGE" &&
git branch -f side side-orig && git branch -f side side-orig &&
git checkout side && git checkout side &&
git merge --no-verify -m "merge master" master && git merge --no-verify -m "merge main" main &&
git checkout master && git checkout main &&
test_path_is_missing actual_hooks test_path_is_missing actual_hooks
' '


@ -215,8 +215,8 @@ test_expect_success POSIXPERM 'with non-executable hook (merge)' '
cp "$HOOKDIR/non-exec.sample" "$PREMERGE" && cp "$HOOKDIR/non-exec.sample" "$PREMERGE" &&
git branch -f side side-orig && git branch -f side side-orig &&
git checkout side && git checkout side &&
git merge -m "merge master" master && git merge -m "merge main" main &&
git checkout master && git checkout main &&
test_path_is_missing actual_hooks test_path_is_missing actual_hooks
' '


@ -225,8 +225,8 @@ test_expect_success POSIXPERM '--no-verify with non-executable hook (merge)' '
cp "$HOOKDIR/non-exec.sample" "$PREMERGE" && cp "$HOOKDIR/non-exec.sample" "$PREMERGE" &&
git branch -f side side-orig && git branch -f side side-orig &&
git checkout side && git checkout side &&
git merge --no-verify -m "merge master" master && git merge --no-verify -m "merge main" main &&
git checkout master && git checkout main &&
test_path_is_missing actual_hooks test_path_is_missing actual_hooks
' '



26
t/t7504-commit-msg-hook.sh

@ -2,7 +2,7 @@


test_description='commit-msg hook' test_description='commit-msg hook'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -145,12 +145,12 @@ test_expect_success '--no-verify with failing hook (editor)' '
test_expect_success 'merge fails with failing hook' ' test_expect_success 'merge fails with failing hook' '


test_when_finished "git branch -D newbranch" && test_when_finished "git branch -D newbranch" &&
test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
git checkout --orphan newbranch && git checkout --orphan newbranch &&
: >file2 && : >file2 &&
git add file2 && git add file2 &&
git commit --no-verify file2 -m in-side-branch && git commit --no-verify file2 -m in-side-branch &&
test_must_fail git merge --allow-unrelated-histories master && test_must_fail git merge --allow-unrelated-histories main &&
commit_msg_is "in-side-branch" # HEAD before merge commit_msg_is "in-side-branch" # HEAD before merge


' '
@ -158,14 +158,14 @@ test_expect_success 'merge fails with failing hook' '
test_expect_success 'merge bypasses failing hook with --no-verify' ' test_expect_success 'merge bypasses failing hook with --no-verify' '


test_when_finished "git branch -D newbranch" && test_when_finished "git branch -D newbranch" &&
test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
git checkout --orphan newbranch && git checkout --orphan newbranch &&
git rm -f file && git rm -f file &&
: >file2 && : >file2 &&
git add file2 && git add file2 &&
git commit --no-verify file2 -m in-side-branch && git commit --no-verify file2 -m in-side-branch &&
git merge --no-verify --allow-unrelated-histories master && git merge --no-verify --allow-unrelated-histories main &&
commit_msg_is "Merge branch '\''master'\'' into newbranch" commit_msg_is "Merge branch '\''main'\'' into newbranch"
' '




@ -251,28 +251,28 @@ test_expect_success "hook doesn't edit commit message (editor)" '


test_expect_success 'hook called in git-merge picks up commit message' ' test_expect_success 'hook called in git-merge picks up commit message' '
test_when_finished "git branch -D newbranch" && test_when_finished "git branch -D newbranch" &&
test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
git checkout --orphan newbranch && git checkout --orphan newbranch &&
git rm -f file && git rm -f file &&
: >file2 && : >file2 &&
git add file2 && git add file2 &&
git commit --no-verify file2 -m in-side-branch && git commit --no-verify file2 -m in-side-branch &&
git merge --allow-unrelated-histories master && git merge --allow-unrelated-histories main &&
commit_msg_is "new message" commit_msg_is "new message"
' '


test_expect_failure 'merge --continue remembers --no-verify' ' test_expect_failure 'merge --continue remembers --no-verify' '
test_when_finished "git branch -D newbranch" && test_when_finished "git branch -D newbranch" &&
test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
git checkout master && git checkout main &&
echo a >file2 && echo a >file2 &&
git add file2 && git add file2 &&
git commit --no-verify -m "add file2 to master" && git commit --no-verify -m "add file2 to main" &&
git checkout -b newbranch master^ && git checkout -b newbranch main^ &&
echo b >file2 && echo b >file2 &&
git add file2 && git add file2 &&
git commit --no-verify file2 -m in-side-branch && git commit --no-verify file2 -m in-side-branch &&
git merge --no-verify -m not-rewritten-by-hook master && git merge --no-verify -m not-rewritten-by-hook main &&
# resolve conflict: # resolve conflict:
echo c >file2 && echo c >file2 &&
git add file2 && git add file2 &&

22
t/t7505-prepare-commit-msg-hook.sh

@ -2,7 +2,7 @@


test_description='prepare-commit-msg hook' test_description='prepare-commit-msg hook'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -18,7 +18,7 @@ test_expect_success 'set up commits for rebasing' '
do do
test_commit rebase-$i c $i test_commit rebase-$i c $i
done && done &&
git checkout master && git checkout main &&


cat >rebase-todo <<-EOF cat >rebase-todo <<-EOF
pick $(git rev-parse rebase-a) pick $(git rev-parse rebase-a)
@ -193,7 +193,7 @@ test_expect_success 'with hook (-c)' '


test_expect_success 'with hook (merge)' ' test_expect_success 'with hook (merge)' '


test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
git checkout -B other HEAD@{1} && git checkout -B other HEAD@{1} &&
echo "more" >>file && echo "more" >>file &&
git add file && git add file &&
@ -205,7 +205,7 @@ test_expect_success 'with hook (merge)' '


test_expect_success 'with hook and editor (merge)' ' test_expect_success 'with hook and editor (merge)' '


test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
git checkout -B other HEAD@{1} && git checkout -B other HEAD@{1} &&
echo "more" >>file && echo "more" >>file &&
git add file && git add file &&
@ -221,7 +221,7 @@ test_rebase () {
test_expect_$expect C_LOCALE_OUTPUT "with hook (rebase ${mode:--i})" ' test_expect_$expect C_LOCALE_OUTPUT "with hook (rebase ${mode:--i})" '
test_when_finished "\ test_when_finished "\
git rebase --abort git rebase --abort
git checkout -f master git checkout -f main
git branch -D tmp" && git branch -D tmp" &&
git checkout -b tmp rebase-me && git checkout -b tmp rebase-me &&
GIT_SEQUENCE_EDITOR="cp rebase-todo" && GIT_SEQUENCE_EDITOR="cp rebase-todo" &&
@ -253,14 +253,14 @@ test_rebase success
test_have_prereq !REBASE_P || test_rebase success -p test_have_prereq !REBASE_P || test_rebase success -p


test_expect_success 'with hook (cherry-pick)' ' test_expect_success 'with hook (cherry-pick)' '
test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
git checkout -B other b && git checkout -B other b &&
git cherry-pick rebase-1 && git cherry-pick rebase-1 &&
test "$(git log -1 --pretty=format:%s)" = "message (no editor)" test "$(git log -1 --pretty=format:%s)" = "message (no editor)"
' '


test_expect_success 'with hook and editor (cherry-pick)' ' test_expect_success 'with hook and editor (cherry-pick)' '
test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
git checkout -B other b && git checkout -B other b &&
git cherry-pick -e rebase-1 && git cherry-pick -e rebase-1 &&
test "$(git log -1 --pretty=format:%s)" = merge test "$(git log -1 --pretty=format:%s)" = merge
@ -273,7 +273,7 @@ EOF


test_expect_success 'with failing hook' ' test_expect_success 'with failing hook' '


test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
head=$(git rev-parse HEAD) && head=$(git rev-parse HEAD) &&
echo "more" >> file && echo "more" >> file &&
git add file && git add file &&
@ -283,7 +283,7 @@ test_expect_success 'with failing hook' '


test_expect_success 'with failing hook (--no-verify)' ' test_expect_success 'with failing hook (--no-verify)' '


test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
head=$(git rev-parse HEAD) && head=$(git rev-parse HEAD) &&
echo "more" >> file && echo "more" >> file &&
git add file && git add file &&
@ -293,7 +293,7 @@ test_expect_success 'with failing hook (--no-verify)' '


test_expect_success 'with failing hook (merge)' ' test_expect_success 'with failing hook (merge)' '


test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
git checkout -B other HEAD@{1} && git checkout -B other HEAD@{1} &&
echo "more" >> file && echo "more" >> file &&
git add file && git add file &&
@ -308,7 +308,7 @@ test_expect_success 'with failing hook (merge)' '
' '


test_expect_success C_LOCALE_OUTPUT 'with failing hook (cherry-pick)' ' test_expect_success C_LOCALE_OUTPUT 'with failing hook (cherry-pick)' '
test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
git checkout -B other b && git checkout -B other b &&
test_must_fail git cherry-pick rebase-1 2>actual && test_must_fail git cherry-pick rebase-1 2>actual &&
test $(grep -c prepare-commit-msg actual) = 1 test $(grep -c prepare-commit-msg actual) = 1

58
t/t7508-status.sh

@ -37,11 +37,11 @@ test_expect_success 'create upstream branch' '
git checkout -b upstream && git checkout -b upstream &&
test_commit upstream1 && test_commit upstream1 &&
test_commit upstream2 && test_commit upstream2 &&
# leave the first commit on master as root because several # leave the first commit on main as root because several
# tests depend on this case; for our upstream we only # tests depend on this case; for our upstream we only
# care about commit counts anyway, so a totally divergent # care about commit counts anyway, so a totally divergent
# history is OK # history is OK
git checkout --orphan master git checkout --orphan main
' '


test_expect_success 'setup' ' test_expect_success 'setup' '
@ -88,7 +88,7 @@ EOF


test_expect_success 'status --column' ' test_expect_success 'status --column' '
cat >expect <<\EOF && cat >expect <<\EOF &&
# On branch master # On branch main
# Your branch and '\''upstream'\'' have diverged, # Your branch and '\''upstream'\'' have diverged,
# and have 1 and 2 different commits each, respectively. # and have 1 and 2 different commits each, respectively.
# (use "git pull" to merge the remote branch into yours) # (use "git pull" to merge the remote branch into yours)
@ -119,7 +119,7 @@ test_expect_success 'status --column status.displayCommentPrefix=false' '
' '


cat >expect <<\EOF cat >expect <<\EOF
# On branch master # On branch main
# Your branch and 'upstream' have diverged, # Your branch and 'upstream' have diverged,
# and have 1 and 2 different commits each, respectively. # and have 1 and 2 different commits each, respectively.
# (use "git pull" to merge the remote branch into yours) # (use "git pull" to merge the remote branch into yours)
@ -193,7 +193,7 @@ test_expect_success 'commit ignores status.displayCommentPrefix=false in COMMIT_
' '


cat >expect <<\EOF cat >expect <<\EOF
On branch master On branch main
Your branch and 'upstream' have diverged, Your branch and 'upstream' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.


@ -266,7 +266,7 @@ test_expect_success 'status with gitignore' '
test_cmp expect output && test_cmp expect output &&


cat >expect <<\EOF && cat >expect <<\EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -331,7 +331,7 @@ test_expect_success 'status with gitignore (nothing untracked)' '
test_cmp expect output && test_cmp expect output &&


cat >expect <<\EOF && cat >expect <<\EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -368,7 +368,7 @@ output*
EOF EOF


cat >expect <<\EOF cat >expect <<\EOF
## master...upstream [ahead 1, behind 2] ## main...upstream [ahead 1, behind 2]
M dir1/modified M dir1/modified
A dir2/added A dir2/added
?? dir1/untracked ?? dir1/untracked
@ -401,7 +401,7 @@ test_expect_success 'setup dir3' '


test_expect_success 'status -uno' ' test_expect_success 'status -uno' '
cat >expect <<EOF && cat >expect <<EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -429,7 +429,7 @@ test_expect_success 'status (status.showUntrackedFiles no)' '


test_expect_success 'status -uno (advice.statusHints false)' ' test_expect_success 'status -uno (advice.statusHints false)' '
cat >expect <<EOF && cat >expect <<EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.


@ -463,7 +463,7 @@ test_expect_success 'status -s (status.showUntrackedFiles no)' '


test_expect_success 'status -unormal' ' test_expect_success 'status -unormal' '
cat >expect <<EOF && cat >expect <<EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -518,7 +518,7 @@ test_expect_success 'status -s (status.showUntrackedFiles normal)' '


test_expect_success 'status -uall' ' test_expect_success 'status -uall' '
cat >expect <<EOF && cat >expect <<EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -578,7 +578,7 @@ test_expect_success 'status -s (status.showUntrackedFiles all)' '


test_expect_success 'status with relative paths' ' test_expect_success 'status with relative paths' '
cat >expect <<\EOF && cat >expect <<\EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -646,7 +646,7 @@ test_expect_success 'setup unique colors' '


test_expect_success TTY 'status with color.ui' ' test_expect_success TTY 'status with color.ui' '
cat >expect <<\EOF && cat >expect <<\EOF &&
On branch <GREEN>master<RESET> On branch <GREEN>main<RESET>
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -706,7 +706,7 @@ test_expect_success TTY 'status -s with color.status' '
' '


cat >expect <<\EOF cat >expect <<\EOF
## <YELLOW>master<RESET>...<CYAN>upstream<RESET> [ahead <YELLOW>1<RESET>, behind <CYAN>2<RESET>] ## <YELLOW>main<RESET>...<CYAN>upstream<RESET> [ahead <YELLOW>1<RESET>, behind <CYAN>2<RESET>]
<RED>M<RESET> dir1/modified <RED>M<RESET> dir1/modified
<GREEN>A<RESET> dir2/added <GREEN>A<RESET> dir2/added
<BLUE>??<RESET> dir1/untracked <BLUE>??<RESET> dir1/untracked
@ -757,7 +757,7 @@ test_expect_success 'status --porcelain respects -b' '


git status --porcelain -b >output && git status --porcelain -b >output &&
{ {
echo "## master...upstream [ahead 1, behind 2]" && echo "## main...upstream [ahead 1, behind 2]" &&
cat expect cat expect
} >tmp && } >tmp &&
mv tmp expect && mv tmp expect &&
@ -769,7 +769,7 @@ test_expect_success 'status --porcelain respects -b' '


test_expect_success 'status without relative paths' ' test_expect_success 'status without relative paths' '
cat >expect <<\EOF && cat >expect <<\EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -843,7 +843,7 @@ test_expect_success 'status -s without relative paths' '


test_expect_success 'dry-run of partial commit excluding new file in index' ' test_expect_success 'dry-run of partial commit excluding new file in index' '
cat >expect <<EOF && cat >expect <<EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -897,7 +897,7 @@ test_expect_success 'setup status submodule summary' '


test_expect_success 'status submodule summary is disabled by default' ' test_expect_success 'status submodule summary is disabled by default' '
cat >expect <<EOF && cat >expect <<EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -954,7 +954,7 @@ head=$(cd sm && git rev-parse --short=7 --verify HEAD)


test_expect_success 'status submodule summary' ' test_expect_success 'status submodule summary' '
cat >expect <<EOF && cat >expect <<EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 1 and 2 different commits each, respectively. and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -1013,7 +1013,7 @@ test_expect_success 'status -s submodule summary' '


test_expect_success 'status submodule summary (clean submodule): commit' ' test_expect_success 'status submodule summary (clean submodule): commit' '
cat >expect <<EOF && cat >expect <<EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 2 and 2 different commits each, respectively. and have 2 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -1061,7 +1061,7 @@ test_expect_success 'status -z implies porcelain' '


test_expect_success 'commit --dry-run submodule summary (--amend)' ' test_expect_success 'commit --dry-run submodule summary (--amend)' '
cat >expect <<EOF && cat >expect <<EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 2 and 2 different commits each, respectively. and have 2 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -1113,7 +1113,7 @@ touch .gitmodules


test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' ' test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
cat > expect << EOF && cat > expect << EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 2 and 2 different commits each, respectively. and have 2 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -1222,7 +1222,7 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with modifie


test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" ' test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
cat > expect << EOF && cat > expect << EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 2 and 2 different commits each, respectively. and have 2 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -1279,7 +1279,7 @@ head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --


test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" ' test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
cat > expect << EOF && cat > expect << EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 2 and 2 different commits each, respectively. and have 2 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -1360,7 +1360,7 @@ test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary
' '


cat > expect << EOF cat > expect << EOF
; On branch master ; On branch main
; Your branch and 'upstream' have diverged, ; Your branch and 'upstream' have diverged,
; and have 2 and 2 different commits each, respectively. ; and have 2 and 2 different commits each, respectively.
; (use "git pull" to merge the remote branch into yours) ; (use "git pull" to merge the remote branch into yours)
@ -1408,7 +1408,7 @@ test_expect_success "status (core.commentchar with two chars with submodule summ


test_expect_success "--ignore-submodules=all suppresses submodule summary" ' test_expect_success "--ignore-submodules=all suppresses submodule summary" '
cat > expect << EOF && cat > expect << EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 2 and 2 different commits each, respectively. and have 2 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -1434,7 +1434,7 @@ EOF


test_expect_success '.gitmodules ignore=all suppresses unstaged submodule summary' ' test_expect_success '.gitmodules ignore=all suppresses unstaged submodule summary' '
cat > expect << EOF && cat > expect << EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 2 and 2 different commits each, respectively. and have 2 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)
@ -1554,7 +1554,7 @@ test_expect_success 'git commit --dry-run will show a staged but ignored submodu
git reset HEAD^ && git reset HEAD^ &&
git add sm && git add sm &&
cat >expect << EOF && cat >expect << EOF &&
On branch master On branch main
Your branch and '\''upstream'\'' have diverged, Your branch and '\''upstream'\'' have diverged,
and have 2 and 2 different commits each, respectively. and have 2 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours) (use "git pull" to merge the remote branch into yours)

4
t/t7510-signed-commit.sh

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh


test_description='signed commit tests' test_description='signed commit tests'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -28,7 +28,7 @@ test_expect_success GPG 'create signed commits' '
echo 3 >elif && git add elif && echo 3 >elif && git add elif &&
test_tick && git commit -m "third on side" && test_tick && git commit -m "third on side" &&


git checkout master && git checkout main &&
test_tick && git merge -S side && test_tick && git merge -S side &&
git tag merge && git tag merge &&



42
t/t7512-status-help.sh

@ -7,7 +7,7 @@


test_description='git status advice' test_description='git status advice'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -20,14 +20,14 @@ test_expect_success 'prepare for conflicts' '
git config --global advice.statusuoption false && git config --global advice.statusuoption false &&
test_commit init main.txt init && test_commit init main.txt init &&
git branch conflicts && git branch conflicts &&
test_commit on_master main.txt on_master && test_commit on_main main.txt on_main &&
git checkout conflicts && git checkout conflicts &&
test_commit on_conflicts main.txt on_conflicts test_commit on_conflicts main.txt on_conflicts
' '




test_expect_success 'status when conflicts unresolved' ' test_expect_success 'status when conflicts unresolved' '
test_must_fail git merge master && test_must_fail git merge main &&
cat >expected <<\EOF && cat >expected <<\EOF &&
On branch conflicts On branch conflicts
You have unmerged paths. You have unmerged paths.
@ -47,7 +47,7 @@ EOF


test_expect_success 'status when conflicts resolved before commit' ' test_expect_success 'status when conflicts resolved before commit' '
git reset --hard conflicts && git reset --hard conflicts &&
test_must_fail git merge master && test_must_fail git merge main &&
echo one >main.txt && echo one >main.txt &&
git add main.txt && git add main.txt &&
cat >expected <<\EOF && cat >expected <<\EOF &&
@ -66,7 +66,7 @@ EOF




test_expect_success 'prepare for rebase conflicts' ' test_expect_success 'prepare for rebase conflicts' '
git reset --hard master && git reset --hard main &&
git checkout -b rebase_conflicts && git checkout -b rebase_conflicts &&
test_commit one_rebase main.txt one && test_commit one_rebase main.txt one &&
test_commit two_rebase main.txt two && test_commit two_rebase main.txt two &&
@ -121,11 +121,11 @@ EOF




test_expect_success 'prepare for rebase_i_conflicts' ' test_expect_success 'prepare for rebase_i_conflicts' '
git reset --hard master && git reset --hard main &&
git checkout -b rebase_i_conflicts && git checkout -b rebase_i_conflicts &&
test_commit one_unmerge main.txt one_unmerge && test_commit one_unmerge main.txt one_unmerge &&
git branch rebase_i_conflicts_second && git branch rebase_i_conflicts_second &&
test_commit one_master main.txt one_master && test_commit one_main main.txt one_main &&
git checkout rebase_i_conflicts_second && git checkout rebase_i_conflicts_second &&
test_commit one_second main.txt one_second test_commit one_second main.txt one_second
' '
@ -185,7 +185,7 @@ EOF




test_expect_success 'status when rebasing -i in edit mode' ' test_expect_success 'status when rebasing -i in edit mode' '
git reset --hard master && git reset --hard main &&
git checkout -b rebase_i_edit && git checkout -b rebase_i_edit &&
test_commit one_rebase_i main.txt one && test_commit one_rebase_i main.txt one &&
test_commit two_rebase_i main.txt two && test_commit two_rebase_i main.txt two &&
@ -215,7 +215,7 @@ EOF




test_expect_success 'status when splitting a commit' ' test_expect_success 'status when splitting a commit' '
git reset --hard master && git reset --hard main &&
git checkout -b split_commit && git checkout -b split_commit &&
test_commit one_split main.txt one && test_commit one_split main.txt one &&
test_commit two_split main.txt two && test_commit two_split main.txt two &&
@ -254,7 +254,7 @@ EOF




test_expect_success 'status after editing the last commit with --amend during a rebase -i' ' test_expect_success 'status after editing the last commit with --amend during a rebase -i' '
git reset --hard master && git reset --hard main &&
git checkout -b amend_last && git checkout -b amend_last &&
test_commit one_amend main.txt one && test_commit one_amend main.txt one &&
test_commit two_amend main.txt two && test_commit two_amend main.txt two &&
@ -287,7 +287,7 @@ EOF




test_expect_success 'prepare for several edits' ' test_expect_success 'prepare for several edits' '
git reset --hard master && git reset --hard main &&
git checkout -b several_edits && git checkout -b several_edits &&
test_commit one_edits main.txt one && test_commit one_edits main.txt one &&
test_commit two_edits main.txt two && test_commit two_edits main.txt two &&
@ -596,7 +596,7 @@ EOF




test_expect_success 'prepare am_session' ' test_expect_success 'prepare am_session' '
git reset --hard master && git reset --hard main &&
git checkout -b am_session && git checkout -b am_session &&
test_commit one_am one.txt "one" && test_commit one_am one.txt "one" &&
test_commit two_am two.txt "two" && test_commit two_am two.txt "two" &&
@ -669,7 +669,7 @@ EOF




test_expect_success 'status when bisecting' ' test_expect_success 'status when bisecting' '
git reset --hard master && git reset --hard main &&
git checkout -b bisect && git checkout -b bisect &&
test_commit one_bisect main.txt one && test_commit one_bisect main.txt one &&
test_commit two_bisect main.txt two && test_commit two_bisect main.txt two &&
@ -692,7 +692,7 @@ EOF




test_expect_success 'status when rebase --apply conflicts with statushints disabled' ' test_expect_success 'status when rebase --apply conflicts with statushints disabled' '
git reset --hard master && git reset --hard main &&
git checkout -b statushints_disabled && git checkout -b statushints_disabled &&
test_when_finished "git config --local advice.statushints true" && test_when_finished "git config --local advice.statushints true" &&
git config --local advice.statushints false && git config --local advice.statushints false &&
@ -717,7 +717,7 @@ EOF




test_expect_success 'prepare for cherry-pick conflicts' ' test_expect_success 'prepare for cherry-pick conflicts' '
git reset --hard master && git reset --hard main &&
git checkout -b cherry_branch && git checkout -b cherry_branch &&
test_commit one_cherry main.txt one && test_commit one_cherry main.txt one &&
test_commit two_cherries main.txt two && test_commit two_cherries main.txt two &&
@ -828,7 +828,7 @@ EOF
' '


test_expect_success 'status while reverting commit (conflicts)' ' test_expect_success 'status while reverting commit (conflicts)' '
git checkout master && git checkout main &&
echo before >to-revert.txt && echo before >to-revert.txt &&
test_commit before to-revert.txt && test_commit before to-revert.txt &&
echo old >to-revert.txt && echo old >to-revert.txt &&
@ -838,7 +838,7 @@ test_expect_success 'status while reverting commit (conflicts)' '
TO_REVERT=$(git rev-parse --short HEAD^) && TO_REVERT=$(git rev-parse --short HEAD^) &&
test_must_fail git revert $TO_REVERT && test_must_fail git revert $TO_REVERT &&
cat >expected <<EOF && cat >expected <<EOF &&
On branch master On branch main
You are currently reverting commit $TO_REVERT. You are currently reverting commit $TO_REVERT.
(fix conflicts and run "git revert --continue") (fix conflicts and run "git revert --continue")
(use "git revert --skip" to skip this patch) (use "git revert --skip" to skip this patch)
@ -859,7 +859,7 @@ test_expect_success 'status while reverting commit (conflicts resolved)' '
echo reverted >to-revert.txt && echo reverted >to-revert.txt &&
git add to-revert.txt && git add to-revert.txt &&
cat >expected <<EOF && cat >expected <<EOF &&
On branch master On branch main
You are currently reverting commit $TO_REVERT. You are currently reverting commit $TO_REVERT.
(all conflicts fixed: run "git revert --continue") (all conflicts fixed: run "git revert --continue")
(use "git revert --skip" to skip this patch) (use "git revert --skip" to skip this patch)
@ -878,7 +878,7 @@ EOF
test_expect_success 'status after reverting commit' ' test_expect_success 'status after reverting commit' '
git revert --continue && git revert --continue &&
cat >expected <<\EOF && cat >expected <<\EOF &&
On branch master On branch main
nothing to commit (use -u to show untracked files) nothing to commit (use -u to show untracked files)
EOF EOF
git status --untracked-files=no >actual && git status --untracked-files=no >actual &&
@ -892,7 +892,7 @@ test_expect_success 'status while reverting after committing conflict resolution
echo reverted >to-revert.txt && echo reverted >to-revert.txt &&
git commit -a && git commit -a &&
cat >expected <<EOF && cat >expected <<EOF &&
On branch master On branch main
Revert currently in progress. Revert currently in progress.
(run "git revert --continue" to continue) (run "git revert --continue" to continue)
(use "git revert --skip" to skip this patch) (use "git revert --skip" to skip this patch)
@ -905,7 +905,7 @@ EOF
' '


test_expect_success 'prepare for different number of commits rebased' ' test_expect_success 'prepare for different number of commits rebased' '
git reset --hard master && git reset --hard main &&
git checkout -b several_commits && git checkout -b several_commits &&
test_commit one_commit main.txt one && test_commit one_commit main.txt one &&
test_commit two_commit main.txt two && test_commit two_commit main.txt two &&

14
t/t7517-per-repo-email.sh

@ -6,7 +6,7 @@


test_description='per-repo forced setting of email address' test_description='per-repo forced setting of email address'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -50,24 +50,24 @@ test_expect_success 'set up rebase scenarios' '


test_expect_success 'fast-forward rebase does not care about ident' ' test_expect_success 'fast-forward rebase does not care about ident' '
git checkout -B tmp side-without-commit && git checkout -B tmp side-without-commit &&
git rebase master git rebase main
' '


test_expect_success 'non-fast-forward rebase refuses to write commits' ' test_expect_success 'non-fast-forward rebase refuses to write commits' '
test_when_finished "git rebase --abort || true" && test_when_finished "git rebase --abort || true" &&
git checkout -B tmp side-with-commit && git checkout -B tmp side-with-commit &&
test_must_fail git rebase master test_must_fail git rebase main
' '


test_expect_success 'fast-forward rebase does not care about ident (interactive)' ' test_expect_success 'fast-forward rebase does not care about ident (interactive)' '
git checkout -B tmp side-without-commit && git checkout -B tmp side-without-commit &&
git rebase -i master git rebase -i main
' '


test_expect_success 'non-fast-forward rebase refuses to write commits (interactive)' ' test_expect_success 'non-fast-forward rebase refuses to write commits (interactive)' '
test_when_finished "git rebase --abort || true" && test_when_finished "git rebase --abort || true" &&
git checkout -B tmp side-with-commit && git checkout -B tmp side-with-commit &&
test_must_fail git rebase -i master test_must_fail git rebase -i main
' '


test_expect_success 'noop interactive rebase does not care about ident' ' test_expect_success 'noop interactive rebase does not care about ident' '
@ -78,14 +78,14 @@ test_expect_success 'noop interactive rebase does not care about ident' '
test_expect_success REBASE_P \ test_expect_success REBASE_P \
'fast-forward rebase does not care about ident (preserve)' ' 'fast-forward rebase does not care about ident (preserve)' '
git checkout -B tmp side-without-commit && git checkout -B tmp side-without-commit &&
git rebase -p master git rebase -p main
' '


test_expect_success REBASE_P \ test_expect_success REBASE_P \
'non-fast-forward rebase refuses to write commits (preserve)' ' 'non-fast-forward rebase refuses to write commits (preserve)' '
test_when_finished "git rebase --abort || true" && test_when_finished "git rebase --abort || true" &&
git checkout -B tmp side-with-commit && git checkout -B tmp side-with-commit &&
test_must_fail git rebase -p master test_must_fail git rebase -p main
' '


test_expect_success 'author.name overrides user.name' ' test_expect_success 'author.name overrides user.name' '

46
t/t7600-merge.sh

@ -14,9 +14,9 @@ Testing basic merge operations/option parsing.
! [c4] c4 ! [c4] c4
! [c5] c5 ! [c5] c5
! [c6] c6 ! [c6] c6
* [master] Merge commit 'c1' * [main] Merge commit 'c1'
-------- --------
- [master] Merge commit 'c1' - [main] Merge commit 'c1'
+ * [c1] commit 1 + * [c1] commit 1
+ [c6] c6 + [c6] c6
+ [c5] c5 + [c5] c5
@ -26,7 +26,7 @@ Testing basic merge operations/option parsing.
+++++++* [c0] commit 0 +++++++* [c0] commit 0
' '


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -206,13 +206,13 @@ test_expect_success 'merge c0 with c1 with --ff-only' '
test_debug 'git log --graph --decorate --oneline --all' test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge from unborn branch' ' test_expect_success 'merge from unborn branch' '
git checkout -f master && git checkout -f main &&
test_might_fail git branch -D kid && test_might_fail git branch -D kid &&


echo "OBJID HEAD@{0}: initial pull" >reflog.expected && echo "OBJID HEAD@{0}: initial pull" >reflog.expected &&


git checkout --orphan kid && git checkout --orphan kid &&
test_when_finished "git checkout -f master" && test_when_finished "git checkout -f main" &&
git rm -fr . && git rm -fr . &&
test_tick && test_tick &&
git merge --ff-only c1 && git merge --ff-only c1 &&
@ -416,7 +416,7 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge c1 with c2 (no-commit in config)' ' test_expect_success 'merge c1 with c2 (no-commit in config)' '
git reset --hard c1 && git reset --hard c1 &&
test_config branch.master.mergeoptions "--no-commit" && test_config branch.main.mergeoptions "--no-commit" &&
git merge c2 && git merge c2 &&
verify_merge file result.1-5 && verify_merge file result.1-5 &&
verify_head $c1 && verify_head $c1 &&
@ -430,7 +430,7 @@ test_expect_success 'merge c1 with c2 (log in config)' '
git merge --log c2 && git merge --log c2 &&
git show -s --pretty=tformat:%s%n%b >expect && git show -s --pretty=tformat:%s%n%b >expect &&


test_config branch.master.mergeoptions "--log" && test_config branch.main.mergeoptions "--log" &&
git reset --hard c1 && git reset --hard c1 &&
git merge c2 && git merge c2 &&
git show -s --pretty=tformat:%s%n%b >actual && git show -s --pretty=tformat:%s%n%b >actual &&
@ -443,7 +443,7 @@ test_expect_success 'merge c1 with c2 (log in config gets overridden)' '
git merge c2 && git merge c2 &&
git show -s --pretty=tformat:%s%n%b >expect && git show -s --pretty=tformat:%s%n%b >expect &&


test_config branch.master.mergeoptions "--no-log" && test_config branch.main.mergeoptions "--no-log" &&
test_config merge.log "true" && test_config merge.log "true" &&
git reset --hard c1 && git reset --hard c1 &&
git merge c2 && git merge c2 &&
@ -454,7 +454,7 @@ test_expect_success 'merge c1 with c2 (log in config gets overridden)' '


test_expect_success 'merge c1 with c2 (squash in config)' ' test_expect_success 'merge c1 with c2 (squash in config)' '
git reset --hard c1 && git reset --hard c1 &&
test_config branch.master.mergeoptions "--squash" && test_config branch.main.mergeoptions "--squash" &&
git merge c2 && git merge c2 &&
verify_merge file result.1-5 && verify_merge file result.1-5 &&
verify_head $c1 && verify_head $c1 &&
@ -466,7 +466,7 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'override config option -n with --summary' ' test_expect_success 'override config option -n with --summary' '
git reset --hard c1 && git reset --hard c1 &&
test_config branch.master.mergeoptions "-n" && test_config branch.main.mergeoptions "-n" &&
test_tick && test_tick &&
git merge --summary c2 >diffstat.txt && git merge --summary c2 >diffstat.txt &&
verify_merge file result.1-5 msg.1-5 && verify_merge file result.1-5 msg.1-5 &&
@ -480,7 +480,7 @@ test_expect_success 'override config option -n with --summary' '


test_expect_success 'override config option -n with --stat' ' test_expect_success 'override config option -n with --stat' '
git reset --hard c1 && git reset --hard c1 &&
test_config branch.master.mergeoptions "-n" && test_config branch.main.mergeoptions "-n" &&
test_tick && test_tick &&
git merge --stat c2 >diffstat.txt && git merge --stat c2 >diffstat.txt &&
verify_merge file result.1-5 msg.1-5 && verify_merge file result.1-5 msg.1-5 &&
@ -496,7 +496,7 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'override config option --stat' ' test_expect_success 'override config option --stat' '
git reset --hard c1 && git reset --hard c1 &&
test_config branch.master.mergeoptions "--stat" && test_config branch.main.mergeoptions "--stat" &&
test_tick && test_tick &&
git merge -n c2 >diffstat.txt && git merge -n c2 >diffstat.txt &&
verify_merge file result.1-5 msg.1-5 && verify_merge file result.1-5 msg.1-5 &&
@ -512,7 +512,7 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge c1 with c2 (override --no-commit)' ' test_expect_success 'merge c1 with c2 (override --no-commit)' '
git reset --hard c1 && git reset --hard c1 &&
test_config branch.master.mergeoptions "--no-commit" && test_config branch.main.mergeoptions "--no-commit" &&
test_tick && test_tick &&
git merge --commit c2 && git merge --commit c2 &&
verify_merge file result.1-5 msg.1-5 && verify_merge file result.1-5 msg.1-5 &&
@ -523,7 +523,7 @@ test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'merge c1 with c2 (override --squash)' ' test_expect_success 'merge c1 with c2 (override --squash)' '
git reset --hard c1 && git reset --hard c1 &&
test_config branch.master.mergeoptions "--squash" && test_config branch.main.mergeoptions "--squash" &&
test_tick && test_tick &&
git merge --no-squash c2 && git merge --no-squash c2 &&
verify_merge file result.1-5 msg.1-5 && verify_merge file result.1-5 msg.1-5 &&
@ -552,9 +552,9 @@ test_expect_success 'merge c0 with c1 (merge.ff=false)' '
' '
test_debug 'git log --graph --decorate --oneline --all' test_debug 'git log --graph --decorate --oneline --all'


test_expect_success 'combine branch.master.mergeoptions with merge.ff' ' test_expect_success 'combine branch.main.mergeoptions with merge.ff' '
git reset --hard c0 && git reset --hard c0 &&
test_config branch.master.mergeoptions "--ff" && test_config branch.main.mergeoptions "--ff" &&
test_config merge.ff "false" && test_config merge.ff "false" &&
test_tick && test_tick &&
git merge c1 && git merge c1 &&
@ -596,7 +596,7 @@ test_expect_success 'option --no-ff overrides merge.ff=only config' '


test_expect_success 'merge c0 with c1 (ff overrides no-ff)' ' test_expect_success 'merge c0 with c1 (ff overrides no-ff)' '
git reset --hard c0 && git reset --hard c0 &&
test_config branch.master.mergeoptions "--no-ff" && test_config branch.main.mergeoptions "--no-ff" &&
git merge --ff c1 && git merge --ff c1 &&
verify_merge file result.1 && verify_merge file result.1 &&
verify_head $c1 verify_head $c1
@ -609,7 +609,7 @@ test_expect_success 'merge log message' '
test_must_be_empty msg.act && test_must_be_empty msg.act &&


git reset --hard c0 && git reset --hard c0 &&
test_config branch.master.mergeoptions "--no-ff" && test_config branch.main.mergeoptions "--no-ff" &&
git merge --no-log c2 && git merge --no-log c2 &&
git show -s --pretty=format:%b HEAD >msg.act && git show -s --pretty=format:%b HEAD >msg.act &&
test_must_be_empty msg.act && test_must_be_empty msg.act &&
@ -953,10 +953,10 @@ test_expect_success 'set up mod-256 conflict scenario' '
git add file && git add file &&
git commit -m base && git commit -m base &&


# one side changes the first line of each to "master" # one side changes the first line of each to "main"
sed s/-1/-master/ file >tmp && sed s/-1/-main/ file >tmp &&
mv tmp file && mv tmp file &&
git commit -am master && git commit -am main &&


# and the other to "side"; merging the two will # and the other to "side"; merging the two will
# yield 256 separate conflicts # yield 256 separate conflicts
@ -968,12 +968,12 @@ test_expect_success 'set up mod-256 conflict scenario' '


test_expect_success 'merge detects mod-256 conflicts (recursive)' ' test_expect_success 'merge detects mod-256 conflicts (recursive)' '
git reset --hard && git reset --hard &&
test_must_fail git merge -s recursive master test_must_fail git merge -s recursive main
' '


test_expect_success 'merge detects mod-256 conflicts (resolve)' ' test_expect_success 'merge detects mod-256 conflicts (resolve)' '
git reset --hard && git reset --hard &&
test_must_fail git merge -s resolve master test_must_fail git merge -s resolve main
' '


test_expect_success 'merge nothing into void' ' test_expect_success 'merge nothing into void' '

2
t/t7606-merge-custom.sh

@ -4,7 +4,7 @@ test_description="git merge


Testing a custom strategy. Testing a custom strategy.


* (HEAD, master) Merge commit 'c3' * (HEAD, main) Merge commit 'c3'
|\ |\
| * (tag: c3) c3 | * (tag: c3) c3
* | (tag: c1) c1 * | (tag: c1) c1

38
t/t7608-merge-messages.sh

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh


test_description='test auto-generated merge messages' test_description='test auto-generated merge messages'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -13,51 +13,51 @@ check_oneline() {
} }


test_expect_success 'merge local branch' ' test_expect_success 'merge local branch' '
test_commit master-1 && test_commit main-1 &&
git checkout -b local-branch && git checkout -b local-branch &&
test_commit branch-1 && test_commit branch-1 &&
git checkout master && git checkout main &&
test_commit master-2 && test_commit main-2 &&
git merge local-branch && git merge local-branch &&
check_oneline "Merge branch Qlocal-branchQ" check_oneline "Merge branch Qlocal-branchQ"
' '


test_expect_success 'merge octopus branches' ' test_expect_success 'merge octopus branches' '
git checkout -b octopus-a master && git checkout -b octopus-a main &&
test_commit octopus-1 && test_commit octopus-1 &&
git checkout -b octopus-b master && git checkout -b octopus-b main &&
test_commit octopus-2 && test_commit octopus-2 &&
git checkout master && git checkout main &&
git merge octopus-a octopus-b && git merge octopus-a octopus-b &&
check_oneline "Merge branches Qoctopus-aQ and Qoctopus-bQ" check_oneline "Merge branches Qoctopus-aQ and Qoctopus-bQ"
' '


test_expect_success 'merge tag' ' test_expect_success 'merge tag' '
git checkout -b tag-branch master && git checkout -b tag-branch main &&
test_commit tag-1 && test_commit tag-1 &&
git checkout master && git checkout main &&
test_commit master-3 && test_commit main-3 &&
git merge tag-1 && git merge tag-1 &&
check_oneline "Merge tag Qtag-1Q" check_oneline "Merge tag Qtag-1Q"
' '


test_expect_success 'ambiguous tag' ' test_expect_success 'ambiguous tag' '
git checkout -b ambiguous master && git checkout -b ambiguous main &&
test_commit ambiguous && test_commit ambiguous &&
git checkout master && git checkout main &&
test_commit master-4 && test_commit main-4 &&
git merge ambiguous && git merge ambiguous &&
check_oneline "Merge tag QambiguousQ" check_oneline "Merge tag QambiguousQ"
' '


test_expect_success 'remote-tracking branch' ' test_expect_success 'remote-tracking branch' '
git checkout -b remote master && git checkout -b remote main &&
test_commit remote-1 && test_commit remote-1 &&
git update-ref refs/remotes/origin/master remote && git update-ref refs/remotes/origin/main remote &&
git checkout master && git checkout main &&
test_commit master-5 && test_commit main-5 &&
git merge origin/master && git merge origin/main &&
check_oneline "Merge remote-tracking branch Qorigin/masterQ" check_oneline "Merge remote-tracking branch Qorigin/mainQ"
' '


test_done test_done

176
t/t7610-mergetool.sh

@ -7,25 +7,25 @@ test_description='git mergetool


Testing basic merge tool invocation' Testing basic merge tool invocation'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh


# All the mergetool test work by checking out a temporary branch based # All the mergetool test work by checking out a temporary branch based
# off 'branch1' and then merging in master and checking the results of # off 'branch1' and then merging in main and checking the results of
# running mergetool # running mergetool


test_expect_success 'setup' ' test_expect_success 'setup' '
test_config rerere.enabled true && test_config rerere.enabled true &&
echo master >file1 && echo main >file1 &&
echo master spaced >"spaced name" && echo main spaced >"spaced name" &&
echo master file11 >file11 && echo main file11 >file11 &&
echo master file12 >file12 && echo main file12 >file12 &&
echo master file13 >file13 && echo main file13 >file13 &&
echo master file14 >file14 && echo main file14 >file14 &&
mkdir subdir && mkdir subdir &&
echo master sub >subdir/file3 && echo main sub >subdir/file3 &&
test_create_repo submod && test_create_repo submod &&
( (
cd submod && cd submod &&
@ -37,7 +37,7 @@ test_expect_success 'setup' '
git add file1 "spaced name" file1[1-4] subdir/file3 .gitmodules submod && git add file1 "spaced name" file1[1-4] subdir/file3 .gitmodules submod &&
git commit -m "add initial versions" && git commit -m "add initial versions" &&


git checkout -b branch1 master && git checkout -b branch1 main &&
git submodule update -N && git submodule update -N &&
echo branch1 change >file1 && echo branch1 change >file1 &&
echo branch1 newfile >file2 && echo branch1 newfile >file2 &&
@ -74,39 +74,39 @@ test_expect_success 'setup' '
test_write_lines one two 3 >c/c/file.txt && test_write_lines one two 3 >c/c/file.txt &&
git commit -a -m"move to c" && git commit -a -m"move to c" &&


git checkout -b stash1 master && git checkout -b stash1 main &&
echo stash1 change file11 >file11 && echo stash1 change file11 >file11 &&
git add file11 && git add file11 &&
git commit -m "stash1 changes" && git commit -m "stash1 changes" &&


git checkout -b stash2 master && git checkout -b stash2 main &&
echo stash2 change file11 >file11 && echo stash2 change file11 >file11 &&
git add file11 && git add file11 &&
git commit -m "stash2 changes" && git commit -m "stash2 changes" &&


git checkout master && git checkout main &&
git submodule update -N && git submodule update -N &&
echo master updated >file1 && echo main updated >file1 &&
echo master new >file2 && echo main new >file2 &&
echo master updated spaced >"spaced name" && echo main updated spaced >"spaced name" &&
echo master both added >both && echo main both added >both &&
echo master updated file12 >file12 && echo main updated file12 >file12 &&
echo master updated file14 >file14 && echo main updated file14 >file14 &&
echo master new sub >subdir/file3 && echo main new sub >subdir/file3 &&
( (
cd submod && cd submod &&
echo master submodule >bar && echo main submodule >bar &&
git add bar && git add bar &&
git commit -m "Add bar on master" && git commit -m "Add bar on main" &&
git checkout -b submod-master git checkout -b submod-main
) && ) &&
git add file1 "spaced name" file12 file14 file2 subdir/file3 submod && git add file1 "spaced name" file12 file14 file2 subdir/file3 submod &&
git add both && git add both &&
git rm file11 && git rm file11 &&
git commit -m "master updates" && git commit -m "main updates" &&


git clean -fdx && git clean -fdx &&
git checkout -b order-file-start master && git checkout -b order-file-start main &&
echo start >a && echo start >a &&
echo start >b && echo start >b &&
git add a b && git add a b &&
@ -133,7 +133,7 @@ test_expect_success 'custom mergetool' '
test_when_finished "git reset --hard" && test_when_finished "git reset --hard" &&
git checkout -b test$test_count branch1 && git checkout -b test$test_count branch1 &&
git submodule update -N && git submodule update -N &&
test_must_fail git merge master && test_must_fail git merge main &&
yes "" | git mergetool both && yes "" | git mergetool both &&
yes "" | git mergetool file1 file1 && yes "" | git mergetool file1 file1 &&
yes "" | git mergetool file2 "spaced name" && yes "" | git mergetool file2 "spaced name" &&
@ -141,11 +141,11 @@ test_expect_success 'custom mergetool' '
yes "d" | git mergetool file11 && yes "d" | git mergetool file11 &&
yes "d" | git mergetool file12 && yes "d" | git mergetool file12 &&
yes "l" | git mergetool submod && yes "l" | git mergetool submod &&
echo "master updated" >expect && echo "main updated" >expect &&
test_cmp expect file1 && test_cmp expect file1 &&
echo "master new" >expect && echo "main new" >expect &&
test_cmp expect file2 && test_cmp expect file2 &&
echo "master new sub" >expect && echo "main new sub" >expect &&
test_cmp expect subdir/file3 && test_cmp expect subdir/file3 &&
echo "branch1 submodule" >expect && echo "branch1 submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
@ -159,7 +159,7 @@ test_expect_success 'gui mergetool' '
test_when_finished "git reset --hard" && test_when_finished "git reset --hard" &&
git checkout -b test$test_count branch1 && git checkout -b test$test_count branch1 &&
git submodule update -N && git submodule update -N &&
test_must_fail git merge master && test_must_fail git merge main &&
yes "" | git mergetool --gui both && yes "" | git mergetool --gui both &&
yes "" | git mergetool -g file1 file1 && yes "" | git mergetool -g file1 file1 &&
yes "" | git mergetool --gui file2 "spaced name" && yes "" | git mergetool --gui file2 "spaced name" &&
@ -167,11 +167,11 @@ test_expect_success 'gui mergetool' '
yes "d" | git mergetool --gui file11 && yes "d" | git mergetool --gui file11 &&
yes "d" | git mergetool --gui file12 && yes "d" | git mergetool --gui file12 &&
yes "l" | git mergetool --gui submod && yes "l" | git mergetool --gui submod &&
echo "gui master updated" >expect && echo "gui main updated" >expect &&
test_cmp expect file1 && test_cmp expect file1 &&
echo "gui master new" >expect && echo "gui main new" >expect &&
test_cmp expect file2 && test_cmp expect file2 &&
echo "gui master new sub" >expect && echo "gui main new sub" >expect &&
test_cmp expect subdir/file3 && test_cmp expect subdir/file3 &&
echo "branch1 submodule" >expect && echo "branch1 submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
@ -182,7 +182,7 @@ test_expect_success 'gui mergetool without merge.guitool set falls back to merge
test_when_finished "git reset --hard" && test_when_finished "git reset --hard" &&
git checkout -b test$test_count branch1 && git checkout -b test$test_count branch1 &&
git submodule update -N && git submodule update -N &&
test_must_fail git merge master && test_must_fail git merge main &&
yes "" | git mergetool --gui both && yes "" | git mergetool --gui both &&
yes "" | git mergetool -g file1 file1 && yes "" | git mergetool -g file1 file1 &&
yes "" | git mergetool --gui file2 "spaced name" && yes "" | git mergetool --gui file2 "spaced name" &&
@ -190,11 +190,11 @@ test_expect_success 'gui mergetool without merge.guitool set falls back to merge
yes "d" | git mergetool --gui file11 && yes "d" | git mergetool --gui file11 &&
yes "d" | git mergetool --gui file12 && yes "d" | git mergetool --gui file12 &&
yes "l" | git mergetool --gui submod && yes "l" | git mergetool --gui submod &&
echo "master updated" >expect && echo "main updated" >expect &&
test_cmp expect file1 && test_cmp expect file1 &&
echo "master new" >expect && echo "main new" >expect &&
test_cmp expect file2 && test_cmp expect file2 &&
echo "master new sub" >expect && echo "main new sub" >expect &&
test_cmp expect subdir/file3 && test_cmp expect subdir/file3 &&
echo "branch1 submodule" >expect && echo "branch1 submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
@ -209,7 +209,7 @@ test_expect_success 'mergetool crlf' '
# test_when_finished is LIFO.) # test_when_finished is LIFO.)
test_config core.autocrlf true && test_config core.autocrlf true &&
git checkout -b test$test_count branch1 && git checkout -b test$test_count branch1 &&
test_must_fail git merge master && test_must_fail git merge main &&
yes "" | git mergetool file1 && yes "" | git mergetool file1 &&
yes "" | git mergetool file2 && yes "" | git mergetool file2 &&
yes "" | git mergetool "spaced name" && yes "" | git mergetool "spaced name" &&
@ -218,11 +218,11 @@ test_expect_success 'mergetool crlf' '
yes "d" | git mergetool file11 && yes "d" | git mergetool file11 &&
yes "d" | git mergetool file12 && yes "d" | git mergetool file12 &&
yes "r" | git mergetool submod && yes "r" | git mergetool submod &&
test "$(printf x | cat file1 -)" = "$(printf "master updated\r\nx")" && test "$(printf x | cat file1 -)" = "$(printf "main updated\r\nx")" &&
test "$(printf x | cat file2 -)" = "$(printf "master new\r\nx")" && test "$(printf x | cat file2 -)" = "$(printf "main new\r\nx")" &&
test "$(printf x | cat subdir/file3 -)" = "$(printf "master new sub\r\nx")" && test "$(printf x | cat subdir/file3 -)" = "$(printf "main new sub\r\nx")" &&
git submodule update -N && git submodule update -N &&
echo "master submodule" >expect && echo "main submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
git commit -m "branch1 resolved with mergetool - autocrlf" git commit -m "branch1 resolved with mergetool - autocrlf"
' '
@ -233,9 +233,9 @@ test_expect_success 'mergetool in subdir' '
git submodule update -N && git submodule update -N &&
( (
cd subdir && cd subdir &&
test_must_fail git merge master && test_must_fail git merge main &&
yes "" | git mergetool file3 && yes "" | git mergetool file3 &&
echo "master new sub" >expect && echo "main new sub" >expect &&
test_cmp expect file3 test_cmp expect file3
) )
' '
@ -246,7 +246,7 @@ test_expect_success 'mergetool on file in parent dir' '
git submodule update -N && git submodule update -N &&
( (
cd subdir && cd subdir &&
test_must_fail git merge master && test_must_fail git merge main &&
yes "" | git mergetool file3 && yes "" | git mergetool file3 &&
yes "" | git mergetool ../file1 && yes "" | git mergetool ../file1 &&
yes "" | git mergetool ../file2 ../spaced\ name && yes "" | git mergetool ../file2 ../spaced\ name &&
@ -254,9 +254,9 @@ test_expect_success 'mergetool on file in parent dir' '
yes "d" | git mergetool ../file11 && yes "d" | git mergetool ../file11 &&
yes "d" | git mergetool ../file12 && yes "d" | git mergetool ../file12 &&
yes "l" | git mergetool ../submod && yes "l" | git mergetool ../submod &&
echo "master updated" >expect && echo "main updated" >expect &&
test_cmp expect ../file1 && test_cmp expect ../file1 &&
echo "master new" >expect && echo "main new" >expect &&
test_cmp expect ../file2 && test_cmp expect ../file2 &&
echo "branch1 submodule" >expect && echo "branch1 submodule" >expect &&
test_cmp expect ../submod/bar && test_cmp expect ../submod/bar &&
@ -268,7 +268,7 @@ test_expect_success 'mergetool skips autoresolved' '
test_when_finished "git reset --hard" && test_when_finished "git reset --hard" &&
git checkout -b test$test_count branch1 && git checkout -b test$test_count branch1 &&
git submodule update -N && git submodule update -N &&
test_must_fail git merge master && test_must_fail git merge main &&
test -n "$(git ls-files -u)" && test -n "$(git ls-files -u)" &&
yes "d" | git mergetool file11 && yes "d" | git mergetool file11 &&
yes "d" | git mergetool file12 && yes "d" | git mergetool file12 &&
@ -283,17 +283,17 @@ test_expect_success 'mergetool merges all from subdir (rerere disabled)' '
test_config rerere.enabled false && test_config rerere.enabled false &&
( (
cd subdir && cd subdir &&
test_must_fail git merge master && test_must_fail git merge main &&
yes "r" | git mergetool ../submod && yes "r" | git mergetool ../submod &&
yes "d" "d" | git mergetool --no-prompt && yes "d" "d" | git mergetool --no-prompt &&
echo "master updated" >expect && echo "main updated" >expect &&
test_cmp expect ../file1 && test_cmp expect ../file1 &&
echo "master new" >expect && echo "main new" >expect &&
test_cmp expect ../file2 && test_cmp expect ../file2 &&
echo "master new sub" >expect && echo "main new sub" >expect &&
test_cmp expect file3 && test_cmp expect file3 &&
( cd .. && git submodule update -N ) && ( cd .. && git submodule update -N ) &&
echo "master submodule" >expect && echo "main submodule" >expect &&
test_cmp expect ../submod/bar && test_cmp expect ../submod/bar &&
git commit -m "branch2 resolved by mergetool from subdir" git commit -m "branch2 resolved by mergetool from subdir"
) )
@ -306,17 +306,17 @@ test_expect_success 'mergetool merges all from subdir (rerere enabled)' '
rm -rf .git/rr-cache && rm -rf .git/rr-cache &&
( (
cd subdir && cd subdir &&
test_must_fail git merge master && test_must_fail git merge main &&
yes "r" | git mergetool ../submod && yes "r" | git mergetool ../submod &&
yes "d" "d" | git mergetool --no-prompt && yes "d" "d" | git mergetool --no-prompt &&
echo "master updated" >expect && echo "main updated" >expect &&
test_cmp expect ../file1 && test_cmp expect ../file1 &&
echo "master new" >expect && echo "main new" >expect &&
test_cmp expect ../file2 && test_cmp expect ../file2 &&
echo "master new sub" >expect && echo "main new sub" >expect &&
test_cmp expect file3 && test_cmp expect file3 &&
( cd .. && git submodule update -N ) && ( cd .. && git submodule update -N ) &&
echo "master submodule" >expect && echo "main submodule" >expect &&
test_cmp expect ../submod/bar && test_cmp expect ../submod/bar &&
git commit -m "branch2 resolved by mergetool from subdir" git commit -m "branch2 resolved by mergetool from subdir"
) )
@ -328,7 +328,7 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '
rm -rf .git/rr-cache && rm -rf .git/rr-cache &&
git checkout -b test$test_count branch1 && git checkout -b test$test_count branch1 &&
git submodule update -N && git submodule update -N &&
test_must_fail git merge master && test_must_fail git merge main &&
yes "l" | git mergetool --no-prompt submod && yes "l" | git mergetool --no-prompt submod &&
yes "d" "d" | git mergetool --no-prompt && yes "d" "d" | git mergetool --no-prompt &&
git submodule update -N && git submodule update -N &&
@ -369,11 +369,11 @@ test_expect_success 'mergetool takes partial path' '
test_config rerere.enabled false && test_config rerere.enabled false &&
git checkout -b test$test_count branch1 && git checkout -b test$test_count branch1 &&
git submodule update -N && git submodule update -N &&
test_must_fail git merge master && test_must_fail git merge main &&


yes "" | git mergetool subdir && yes "" | git mergetool subdir &&


echo "master new sub" >expect && echo "main new sub" >expect &&
test_cmp expect subdir/file3 test_cmp expect subdir/file3
' '


@ -437,7 +437,7 @@ test_expect_success 'deleted vs modified submodule' '
git rm --cached submod && git rm --cached submod &&
git commit -m "Submodule deleted from branch" && git commit -m "Submodule deleted from branch" &&
git checkout -b test$test_count.a test$test_count && git checkout -b test$test_count.a test$test_count &&
test_must_fail git merge master && test_must_fail git merge main &&
test -n "$(git ls-files -u)" && test -n "$(git ls-files -u)" &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 && yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool both && yes "" | git mergetool both &&
@ -447,7 +447,7 @@ test_expect_success 'deleted vs modified submodule' '
echo "branch1 submodule" >expect && echo "branch1 submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
git submodule update -N && git submodule update -N &&
echo "master submodule" >expect && echo "main submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
output="$(git mergetool --no-prompt)" && output="$(git mergetool --no-prompt)" &&
test "$output" = "No files need merging" && test "$output" = "No files need merging" &&
@ -456,7 +456,7 @@ test_expect_success 'deleted vs modified submodule' '
mv submod submod-movedaside && mv submod submod-movedaside &&
git checkout -b test$test_count.b test$test_count && git checkout -b test$test_count.b test$test_count &&
git submodule update -N && git submodule update -N &&
test_must_fail git merge master && test_must_fail git merge main &&
test -n "$(git ls-files -u)" && test -n "$(git ls-files -u)" &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 && yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool both && yes "" | git mergetool both &&
@ -468,7 +468,7 @@ test_expect_success 'deleted vs modified submodule' '
git commit -m "Merge resolved by deleting module" && git commit -m "Merge resolved by deleting module" &&


mv submod-movedaside submod && mv submod-movedaside submod &&
git checkout -b test$test_count.c master && git checkout -b test$test_count.c main &&
git submodule update -N && git submodule update -N &&
test_must_fail git merge test$test_count && test_must_fail git merge test$test_count &&
test -n "$(git ls-files -u)" && test -n "$(git ls-files -u)" &&
@ -484,7 +484,7 @@ test_expect_success 'deleted vs modified submodule' '
git commit -m "Merge resolved by deleting module" && git commit -m "Merge resolved by deleting module" &&
mv submod.orig submod && mv submod.orig submod &&


git checkout -b test$test_count.d master && git checkout -b test$test_count.d main &&
git submodule update -N && git submodule update -N &&
test_must_fail git merge test$test_count && test_must_fail git merge test$test_count &&
test -n "$(git ls-files -u)" && test -n "$(git ls-files -u)" &&
@ -492,10 +492,10 @@ test_expect_success 'deleted vs modified submodule' '
yes "" | git mergetool both && yes "" | git mergetool both &&
yes "d" | git mergetool file11 file12 && yes "d" | git mergetool file11 file12 &&
yes "l" | git mergetool submod && yes "l" | git mergetool submod &&
echo "master submodule" >expect && echo "main submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
git submodule update -N && git submodule update -N &&
echo "master submodule" >expect && echo "main submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
output="$(git mergetool --no-prompt)" && output="$(git mergetool --no-prompt)" &&
test "$output" = "No files need merging" && test "$output" = "No files need merging" &&
@ -512,7 +512,7 @@ test_expect_success 'file vs modified submodule' '
git add submod && git add submod &&
git commit -m "Submodule path becomes file" && git commit -m "Submodule path becomes file" &&
git checkout -b test$test_count.a branch1 && git checkout -b test$test_count.a branch1 &&
test_must_fail git merge master && test_must_fail git merge main &&
test -n "$(git ls-files -u)" && test -n "$(git ls-files -u)" &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 && yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool both && yes "" | git mergetool both &&
@ -522,7 +522,7 @@ test_expect_success 'file vs modified submodule' '
echo "branch1 submodule" >expect && echo "branch1 submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
git submodule update -N && git submodule update -N &&
echo "master submodule" >expect && echo "main submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
output="$(git mergetool --no-prompt)" && output="$(git mergetool --no-prompt)" &&
test "$output" = "No files need merging" && test "$output" = "No files need merging" &&
@ -530,7 +530,7 @@ test_expect_success 'file vs modified submodule' '


mv submod submod-movedaside && mv submod submod-movedaside &&
git checkout -b test$test_count.b test$test_count && git checkout -b test$test_count.b test$test_count &&
test_must_fail git merge master && test_must_fail git merge main &&
test -n "$(git ls-files -u)" && test -n "$(git ls-files -u)" &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 && yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool both && yes "" | git mergetool both &&
@ -550,7 +550,7 @@ test_expect_success 'file vs modified submodule' '
test "$output" = "No files need merging" && test "$output" = "No files need merging" &&
git commit -m "Merge resolved by keeping file" && git commit -m "Merge resolved by keeping file" &&


git checkout -b test$test_count.c master && git checkout -b test$test_count.c main &&
rmdir submod && mv submod-movedaside submod && rmdir submod && mv submod-movedaside submod &&
test ! -e submod.orig && test ! -e submod.orig &&
git submodule update -N && git submodule update -N &&
@ -576,7 +576,7 @@ test_expect_success 'file vs modified submodule' '
test "$output" = "No files need merging" && test "$output" = "No files need merging" &&
git commit -m "Merge resolved by keeping file" && git commit -m "Merge resolved by keeping file" &&


git checkout -b test$test_count.d master && git checkout -b test$test_count.d main &&
rmdir submod && mv submod.orig submod && rmdir submod && mv submod.orig submod &&
git submodule update -N && git submodule update -N &&
test_must_fail git merge test$test_count && test_must_fail git merge test$test_count &&
@ -589,10 +589,10 @@ test_expect_success 'file vs modified submodule' '
then then
yes "d" | git mergetool submod~test19 yes "d" | git mergetool submod~test19
fi && fi &&
echo "master submodule" >expect && echo "main submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
git submodule update -N && git submodule update -N &&
echo "master submodule" >expect && echo "main submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
output="$(git mergetool --no-prompt)" && output="$(git mergetool --no-prompt)" &&
test "$output" = "No files need merging" && test "$output" = "No files need merging" &&
@ -675,7 +675,7 @@ test_expect_success 'directory vs modified submodule' '
git add submod/file16 && git add submod/file16 &&
git commit -m "Submodule path becomes directory" && git commit -m "Submodule path becomes directory" &&


test_must_fail git merge master && test_must_fail git merge main &&
test -n "$(git ls-files -u)" && test -n "$(git ls-files -u)" &&
yes "l" | git mergetool submod && yes "l" | git mergetool submod &&
echo "not a submodule" >expect && echo "not a submodule" >expect &&
@ -683,14 +683,14 @@ test_expect_success 'directory vs modified submodule' '
rm -rf submod.orig && rm -rf submod.orig &&


git reset --hard && git reset --hard &&
test_must_fail git merge master && test_must_fail git merge main &&
test -n "$(git ls-files -u)" && test -n "$(git ls-files -u)" &&
test ! -e submod.orig && test ! -e submod.orig &&
if test "$GIT_TEST_MERGE_ALGORITHM" = ort if test "$GIT_TEST_MERGE_ALGORITHM" = ort
then then
yes "r" | git mergetool submod~master && yes "r" | git mergetool submod~main &&
git mv submod submod.orig && git mv submod submod.orig &&
git mv submod~master submod git mv submod~main submod
else else
yes "r" | git mergetool submod yes "r" | git mergetool submod
fi && fi &&
@ -701,18 +701,18 @@ test_expect_success 'directory vs modified submodule' '
mv submod-movedaside/.git submod && mv submod-movedaside/.git submod &&
( cd submod && git clean -f && git reset --hard ) && ( cd submod && git clean -f && git reset --hard ) &&
git submodule update -N && git submodule update -N &&
echo "master submodule" >expect && echo "main submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&
git reset --hard && git reset --hard &&
rm -rf submod-movedaside && rm -rf submod-movedaside &&


git checkout -b test$test_count.c master && git checkout -b test$test_count.c main &&
git submodule update -N && git submodule update -N &&
test_must_fail git merge test$test_count && test_must_fail git merge test$test_count &&
test -n "$(git ls-files -u)" && test -n "$(git ls-files -u)" &&
yes "l" | git mergetool submod && yes "l" | git mergetool submod &&
git submodule update -N && git submodule update -N &&
echo "master submodule" >expect && echo "main submodule" >expect &&
test_cmp expect submod/bar && test_cmp expect submod/bar &&


git reset --hard && git reset --hard &&
@ -724,7 +724,7 @@ test_expect_success 'directory vs modified submodule' '
echo "not a submodule" >expect && echo "not a submodule" >expect &&
test_cmp expect submod/file16 && test_cmp expect submod/file16 &&


git reset --hard master && git reset --hard main &&
( cd submod && git clean -f && git reset --hard ) && ( cd submod && git clean -f && git reset --hard ) &&
git submodule update -N git submodule update -N
' '
@ -732,7 +732,7 @@ test_expect_success 'directory vs modified submodule' '
test_expect_success 'file with no base' ' test_expect_success 'file with no base' '
test_when_finished "git reset --hard" && test_when_finished "git reset --hard" &&
git checkout -b test$test_count branch1 && git checkout -b test$test_count branch1 &&
test_must_fail git merge master && test_must_fail git merge main &&
git mergetool --no-prompt --tool mybase -- both && git mergetool --no-prompt --tool mybase -- both &&
test_must_be_empty both test_must_be_empty both
' '
@ -742,9 +742,9 @@ test_expect_success 'custom commands override built-ins' '
git checkout -b test$test_count branch1 && git checkout -b test$test_count branch1 &&
test_config mergetool.defaults.cmd "cat \"\$REMOTE\" >\"\$MERGED\"" && test_config mergetool.defaults.cmd "cat \"\$REMOTE\" >\"\$MERGED\"" &&
test_config mergetool.defaults.trustExitCode true && test_config mergetool.defaults.trustExitCode true &&
test_must_fail git merge master && test_must_fail git merge main &&
git mergetool --no-prompt --tool defaults -- both && git mergetool --no-prompt --tool defaults -- both &&
echo master both added >expected && echo main both added >expected &&
test_cmp expected both test_cmp expected both
' '


@ -754,7 +754,7 @@ test_expect_success 'filenames seen by tools start with ./' '
test_config mergetool.writeToTemp false && test_config mergetool.writeToTemp false &&
test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" && test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
test_config mergetool.myecho.trustExitCode true && test_config mergetool.myecho.trustExitCode true &&
test_must_fail git merge master && test_must_fail git merge main &&
git mergetool --no-prompt --tool myecho -- both >actual && git mergetool --no-prompt --tool myecho -- both >actual &&
grep ^\./both_LOCAL_ actual grep ^\./both_LOCAL_ actual
' '
@ -771,7 +771,7 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT
test_config mergetool.writeToTemp true && test_config mergetool.writeToTemp true &&
test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" && test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
test_config mergetool.myecho.trustExitCode true && test_config mergetool.myecho.trustExitCode true &&
test_must_fail git merge master && test_must_fail git merge main &&
git mergetool --no-prompt --tool myecho -- both >actual && git mergetool --no-prompt --tool myecho -- both >actual &&
! grep ^\./both_LOCAL_ actual && ! grep ^\./both_LOCAL_ actual &&
grep /both_LOCAL_ actual grep /both_LOCAL_ actual

6
t/t7611-merge-abort.sh

@ -7,7 +7,7 @@ Set up repo with conflicting and non-conflicting branches:
There are three files foo/bar/baz, and the following graph illustrates the There are three files foo/bar/baz, and the following graph illustrates the
content of these files in each commit: content of these files in each commit:


# foo/bar/baz --- foo/bar/bazz <-- master # foo/bar/baz --- foo/bar/bazz <-- main
# \ # \
# --- foo/barf/bazf <-- conflict_branch # --- foo/barf/bazf <-- conflict_branch
# \ # \
@ -22,7 +22,7 @@ Next, test git merge --abort with the following variables:
- changed/unchanged worktree after merge - changed/unchanged worktree after merge
- changed/unchanged index after merge - changed/unchanged index after merge
' '
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -43,7 +43,7 @@ test_expect_success 'setup' '
git checkout -b clean_branch HEAD^ && git checkout -b clean_branch HEAD^ &&
echo bart > bar && echo bart > bar &&
git commit -a -m "clean" && git commit -a -m "clean" &&
git checkout master git checkout main
' '


pre_merge_head="$(git rev-parse HEAD)" pre_merge_head="$(git rev-parse HEAD)"

4
t/t7612-merge-verify-signatures.sh

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh


test_description='merge signature verification tests' test_description='merge signature verification tests'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -34,7 +34,7 @@ test_expect_success GPG 'create signed commits' '
echo 3 >baz && git add baz && echo 3 >baz && git add baz &&
test_tick && git commit -SB7227189 -m "untrusted on side" && test_tick && git commit -SB7227189 -m "untrusted on side" &&


git checkout master git checkout main
' '


test_expect_success GPG 'merge unsigned commit with verification' ' test_expect_success GPG 'merge unsigned commit with verification' '

26
t/t7614-merge-signoff.sh

@ -5,7 +5,7 @@ test_description='git merge --signoff
This test runs git merge --signoff and makes sure that it works. This test runs git merge --signoff and makes sure that it works.
' '


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -14,17 +14,17 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
test_setup() { test_setup() {
# Expected commit message after merge --signoff # Expected commit message after merge --signoff
cat >expected-signed <<EOF && cat >expected-signed <<EOF &&
Merge branch 'master' into other-branch Merge branch 'main' into other-branch


Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/") Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
EOF EOF


# Expected commit message after merge without --signoff (or with --no-signoff) # Expected commit message after merge without --signoff (or with --no-signoff)
cat >expected-unsigned <<EOF && cat >expected-unsigned <<EOF &&
Merge branch 'master' into other-branch Merge branch 'main' into other-branch
EOF EOF


# Initial commit and feature branch to merge master into it. # Initial commit and feature branch to merge main into it.
git commit --allow-empty -m "Initial empty commit" && git commit --allow-empty -m "Initial empty commit" &&
git checkout -b other-branch && git checkout -b other-branch &&
test_commit other-branch file1 1 test_commit other-branch file1 1
@ -41,30 +41,30 @@ test_expect_success 'setup' '


# Test with --signoff flag # Test with --signoff flag
test_expect_success 'git merge --signoff adds a sign-off line' ' test_expect_success 'git merge --signoff adds a sign-off line' '
git checkout master && git checkout main &&
test_commit master-branch-2 file2 2 && test_commit main-branch-2 file2 2 &&
git checkout other-branch && git checkout other-branch &&
git merge master --signoff --no-edit && git merge main --signoff --no-edit &&
git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
test_cmp expected-signed actual test_cmp expected-signed actual
' '


# Test without --signoff flag # Test without --signoff flag
test_expect_success 'git merge does not add a sign-off line' ' test_expect_success 'git merge does not add a sign-off line' '
git checkout master && git checkout main &&
test_commit master-branch-3 file3 3 && test_commit main-branch-3 file3 3 &&
git checkout other-branch && git checkout other-branch &&
git merge master --no-edit && git merge main --no-edit &&
git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
test_cmp expected-unsigned actual test_cmp expected-unsigned actual
' '


# Test for --no-signoff flag # Test for --no-signoff flag
test_expect_success 'git merge --no-signoff flag cancels --signoff flag' ' test_expect_success 'git merge --no-signoff flag cancels --signoff flag' '
git checkout master && git checkout main &&
test_commit master-branch-4 file4 4 && test_commit main-branch-4 file4 4 &&
git checkout other-branch && git checkout other-branch &&
git merge master --no-edit --signoff --no-signoff && git merge main --no-edit --signoff --no-signoff &&
git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
test_cmp expected-unsigned actual test_cmp expected-unsigned actual
' '

4
t/t7701-repack-unpack-unreachable.sh

@ -2,7 +2,7 @@


test_description='git repack works correctly' test_description='git repack works correctly'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -25,7 +25,7 @@ test_expect_success '-A with -d option leaves unreachable objects unpacked' '
git commit -a -m more_content && git commit -a -m more_content &&
csha1=$(git rev-parse HEAD^{commit}) && csha1=$(git rev-parse HEAD^{commit}) &&
tsha1=$(git rev-parse HEAD^{tree}) && tsha1=$(git rev-parse HEAD^{tree}) &&
git checkout master && git checkout main &&
echo even more content >> file1 && echo even more content >> file1 &&
test_tick && test_tick &&
git commit -a -m even_more_content && git commit -a -m even_more_content &&

40
t/t7800-difftool.sh

@ -8,7 +8,7 @@ test_description='git-difftool
Testing basic diff tool invocation Testing basic diff tool invocation
' '


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -38,23 +38,23 @@ test_expect_success 'basic usage requires no repo' '
test_i18ngrep ^usage: output test_i18ngrep ^usage: output
' '


# Create a file on master and change it on branch # Create a file on main and change it on branch
test_expect_success 'setup' ' test_expect_success 'setup' '
echo master >file && echo main >file &&
git add file && git add file &&
git commit -m "added file" && git commit -m "added file" &&


git checkout -b branch master && git checkout -b branch main &&
echo branch >file && echo branch >file &&
git commit -a -m "branch changed file" && git commit -a -m "branch changed file" &&
git checkout master git checkout main
' '


# Configure a custom difftool.<tool>.cmd and use it # Configure a custom difftool.<tool>.cmd and use it
test_expect_success 'custom commands' ' test_expect_success 'custom commands' '
difftool_test_setup && difftool_test_setup &&
test_config difftool.test-tool.cmd "cat \"\$REMOTE\"" && test_config difftool.test-tool.cmd "cat \"\$REMOTE\"" &&
echo master >expect && echo main >expect &&
git difftool --no-prompt branch >actual && git difftool --no-prompt branch >actual &&
test_cmp expect actual && test_cmp expect actual &&


@ -66,7 +66,7 @@ test_expect_success 'custom commands' '


test_expect_success 'custom tool commands override built-ins' ' test_expect_success 'custom tool commands override built-ins' '
test_config difftool.vimdiff.cmd "cat \"\$REMOTE\"" && test_config difftool.vimdiff.cmd "cat \"\$REMOTE\"" &&
echo master >expect && echo main >expect &&
git difftool --tool vimdiff --no-prompt branch >actual && git difftool --tool vimdiff --no-prompt branch >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -314,21 +314,21 @@ test_expect_success 'difftool.<tool>.path' '


test_expect_success 'difftool --extcmd=cat' ' test_expect_success 'difftool --extcmd=cat' '
echo branch >expect && echo branch >expect &&
echo master >>expect && echo main >>expect &&
git difftool --no-prompt --extcmd=cat branch >actual && git difftool --no-prompt --extcmd=cat branch >actual &&
test_cmp expect actual test_cmp expect actual
' '


test_expect_success 'difftool --extcmd cat' ' test_expect_success 'difftool --extcmd cat' '
echo branch >expect && echo branch >expect &&
echo master >>expect && echo main >>expect &&
git difftool --no-prompt --extcmd=cat branch >actual && git difftool --no-prompt --extcmd=cat branch >actual &&
test_cmp expect actual test_cmp expect actual
' '


test_expect_success 'difftool -x cat' ' test_expect_success 'difftool -x cat' '
echo branch >expect && echo branch >expect &&
echo master >>expect && echo main >>expect &&
git difftool --no-prompt -x cat branch >actual && git difftool --no-prompt -x cat branch >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -341,7 +341,7 @@ test_expect_success 'difftool --extcmd echo arg1' '
' '


test_expect_success 'difftool --extcmd cat arg1' ' test_expect_success 'difftool --extcmd cat arg1' '
echo master >expect && echo main >expect &&
git difftool --no-prompt \ git difftool --no-prompt \
--extcmd sh\ -c\ \"cat\ \$1\" branch >actual && --extcmd sh\ -c\ \"cat\ \$1\" branch >actual &&
test_cmp expect actual test_cmp expect actual
@ -354,7 +354,7 @@ test_expect_success 'difftool --extcmd cat arg2' '
test_cmp expect actual test_cmp expect actual
' '


# Create a second file on master and a different version on branch # Create a second file on main and a different version on branch
test_expect_success 'setup with 2 files different' ' test_expect_success 'setup with 2 files different' '
echo m2 >file2 && echo m2 >file2 &&
git add file2 && git add file2 &&
@ -364,7 +364,7 @@ test_expect_success 'setup with 2 files different' '
echo br2 >file2 && echo br2 >file2 &&
git add file2 && git add file2 &&
git commit -a -m "branch changed file2" && git commit -a -m "branch changed file2" &&
git checkout master git checkout main
' '


test_expect_success 'say no to the first file' ' test_expect_success 'say no to the first file' '
@ -372,14 +372,14 @@ test_expect_success 'say no to the first file' '
git difftool -x cat branch <input >output && git difftool -x cat branch <input >output &&
grep m2 output && grep m2 output &&
grep br2 output && grep br2 output &&
! grep master output && ! grep main output &&
! grep branch output ! grep branch output
' '


test_expect_success 'say no to the second file' ' test_expect_success 'say no to the second file' '
(echo && echo n) >input && (echo && echo n) >input &&
git difftool -x cat branch <input >output && git difftool -x cat branch <input >output &&
grep master output && grep main output &&
grep branch output && grep branch output &&
! grep m2 output && ! grep m2 output &&
! grep br2 output ! grep br2 output
@ -387,7 +387,7 @@ test_expect_success 'say no to the second file' '


test_expect_success 'ending prompt input with EOF' ' test_expect_success 'ending prompt input with EOF' '
git difftool -x cat branch </dev/null >output && git difftool -x cat branch </dev/null >output &&
! grep master output && ! grep main output &&
! grep branch output && ! grep branch output &&
! grep m2 output && ! grep m2 output &&
! grep br2 output ! grep br2 output
@ -399,9 +399,9 @@ test_expect_success 'difftool --tool-help' '
' '


test_expect_success 'setup change in subdirectory' ' test_expect_success 'setup change in subdirectory' '
git checkout master && git checkout main &&
mkdir sub && mkdir sub &&
echo master >sub/sub && echo main >sub/sub &&
git add sub/sub && git add sub/sub &&
git commit -m "added sub/sub" && git commit -m "added sub/sub" &&
git tag v1 && git tag v1 &&
@ -529,7 +529,7 @@ run_dir_diff_test 'difftool --dir-diff from subdirectory with GIT_DIR set' '
run_dir_diff_test 'difftool --dir-diff when worktree file is missing' ' run_dir_diff_test 'difftool --dir-diff when worktree file is missing' '
test_when_finished git reset --hard && test_when_finished git reset --hard &&
rm file2 && rm file2 &&
git difftool --dir-diff $symlinks --extcmd ls branch master >output && git difftool --dir-diff $symlinks --extcmd ls branch main >output &&
grep file2 output grep file2 output
' '


@ -546,7 +546,7 @@ run_dir_diff_test 'difftool --dir-diff with unmerged files' '
echo b >>file && echo b >>file &&
git add file && git add file &&
git commit -m conflict-b && git commit -m conflict-b &&
git checkout master && git checkout main &&
git merge conflict-a && git merge conflict-a &&
test_must_fail git merge conflict-b && test_must_fail git merge conflict-b &&
cat >expect <<-EOF && cat >expect <<-EOF &&

30
t/t7810-grep.sh

@ -6,7 +6,7 @@
test_description='git grep various. test_description='git grep various.
' '


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -1209,19 +1209,19 @@ test_expect_success 'grep -e -- -- path' '
' '


test_expect_success 'dashdash disambiguates rev as rev' ' test_expect_success 'dashdash disambiguates rev as rev' '
test_when_finished "rm -f master" && test_when_finished "rm -f main" &&
echo content >master && echo content >main &&
echo master:hello.c >expect && echo main:hello.c >expect &&
git grep -l o master -- hello.c >actual && git grep -l o main -- hello.c >actual &&
test_cmp expect actual test_cmp expect actual
' '


test_expect_success 'dashdash disambiguates pathspec as pathspec' ' test_expect_success 'dashdash disambiguates pathspec as pathspec' '
test_when_finished "git rm -f master" && test_when_finished "git rm -f main" &&
echo content >master && echo content >main &&
git add master && git add main &&
echo master:content >expect && echo main:content >expect &&
git grep o -- master >actual && git grep o -- main >actual &&
test_cmp expect actual test_cmp expect actual
' '


@ -1257,15 +1257,15 @@ test_expect_success 'grep --no-index pattern -- path' '
' '


test_expect_success 'grep --no-index complains of revs' ' test_expect_success 'grep --no-index complains of revs' '
test_must_fail git grep --no-index o master -- 2>err && test_must_fail git grep --no-index o main -- 2>err &&
test_i18ngrep "cannot be used with revs" err test_i18ngrep "cannot be used with revs" err
' '


test_expect_success 'grep --no-index prefers paths to revs' ' test_expect_success 'grep --no-index prefers paths to revs' '
test_when_finished "rm -f master" && test_when_finished "rm -f main" &&
echo content >master && echo content >main &&
echo master:content >expect && echo main:content >expect &&
git grep --no-index o master >actual && git grep --no-index o main >actual &&
test_cmp expect actual test_cmp expect actual
' '



Loading…
Cancel
Save