t3[0-3]*: adjust the references to the default branch name "main"
Carefully excluding t3040, which sees independent development elsewhere
at the time of writing, we transition above-mentioned tests to the
default branch name `main`. This trick was performed via
$ (cd t &&
sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
-e 's/Master/Main/g' -- t3[0-3]*.sh t3206/* &&
git checkout HEAD -- t3040\*)
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 Schindelin4 years agocommitted byJunio C Hamano
@ -188,7 +188,7 @@ test_expect_success 'git branch -M should leave orphaned HEAD alone' '
@@ -188,7 +188,7 @@ test_expect_success 'git branch -M should leave orphaned HEAD alone' '
git checkout --orphan lonely &&
grep lonely .git/HEAD &&
test_path_is_missing .git/refs/head/lonely &&
git branch -M master mistress &&
git branch -M main mistress &&
grep lonely .git/HEAD
)
'
@ -204,7 +204,7 @@ test_expect_success 'resulting reflog can be shown by log -g' '
@@ -204,7 +204,7 @@ test_expect_success 'resulting reflog can be shown by log -g' '
'
test_expect_success 'git branch -M baz bam should succeed when baz is checked out as linked working tree' '
git checkout master &&
git checkout main &&
git worktree add -b baz bazdir &&
git worktree add -f bazdir2 baz &&
git branch -M baz bam &&
@ -227,18 +227,18 @@ test_expect_success 'git branch -M baz bam should succeed within a worktree in w
@@ -227,18 +227,18 @@ test_expect_success 'git branch -M baz bam should succeed within a worktree in w
git worktree prune
'
test_expect_success 'git branch -M master should work when master is checked out' '
git checkout master &&
git branch -M master
test_expect_success 'git branch -M main should work when main is checked out' '
git checkout main &&
git branch -M main
'
test_expect_success 'git branch -M master master should work when master is checked out' '
git checkout master &&
git branch -M master master
test_expect_success 'git branch -M main main should work when main is checked out' '
git checkout main &&
git branch -M main main
'
test_expect_success 'git branch -M topic topic should work when master is checked out' '
git checkout master &&
test_expect_success 'git branch -M topic topic should work when main is checked out' '
git checkout main &&
git branch topic &&
git branch -M topic topic
'
@ -295,8 +295,8 @@ test_expect_success 'bare main worktree has HEAD at branch deleted by secondary
@@ -295,8 +295,8 @@ test_expect_success 'bare main worktree has HEAD at branch deleted by secondary
git init nonbare &&
test_commit -C nonbare x &&
git clone --bare nonbare bare &&
git -C bare worktree add --detach ../secondary master &&
git -C secondary branch -D master
git -C bare worktree add --detach ../secondary main &&
git -C secondary branch -D main
'
test_expect_success 'git branch --list -v with --abbrev' '
@ -348,7 +348,7 @@ test_expect_success 'git branch --column with an extremely long branch name' '
@@ -348,7 +348,7 @@ test_expect_success 'git branch --column with an extremely long branch name' '
# Assert that a config file with multiple config sections has
# those sections preserved...
@ -590,18 +590,18 @@ test_expect_success 'git branch -C c1 c2 should never touch HEAD' '
@@ -590,18 +590,18 @@ test_expect_success 'git branch -C c1 c2 should never touch HEAD' '
! grep "$msg$" .git/logs/HEAD
'
test_expect_success 'git branch -C master should work when master is checked out' '
git checkout master &&
git branch -C master
test_expect_success 'git branch -C main should work when main is checked out' '
git checkout main &&
git branch -C main
'
test_expect_success 'git branch -C master master should work when master is checked out' '
git checkout master &&
git branch -C master master
test_expect_success 'git branch -C main main should work when main is checked out' '
git checkout main &&
git branch -C main main
'
test_expect_success 'git branch -C main5 main5 should work when master is checked out' '
git checkout master &&
test_expect_success 'git branch -C main5 main5 should work when main is checked out' '
git checkout main &&
git branch main5 &&
git branch -C main5 main5
'
@ -623,8 +623,8 @@ test_expect_success 'git branch -C ab cd should overwrite existing config for cd
@@ -623,8 +623,8 @@ test_expect_success 'git branch -C ab cd should overwrite existing config for cd
@ -731,27 +731,27 @@ test_expect_success SYMLINKS 'git branch -m u v should fail when the reflog for
@@ -731,27 +731,27 @@ test_expect_success SYMLINKS 'git branch -m u v should fail when the reflog for
test_expect_success 'test tracking setup via --track' '
test "$(git config branch.my13.merge)" = "refs/heads/master"
test "$(git config branch.my13.merge)" = "refs/heads/main"
'
test_expect_success '--unset-upstream should fail if given a non-existent branch' '
@ -909,14 +909,14 @@ test_expect_success '--unset-upstream should fail if config is locked' '
@@ -909,14 +909,14 @@ test_expect_success '--unset-upstream should fail if config is locked' '
test_expect_success 'test --unset-upstream on HEAD' '
git branch my14 &&
test_config branch.master.remote foo &&
test_config branch.master.merge foo &&
test_config branch.main.remote foo &&
test_config branch.main.merge foo &&
git branch --set-upstream-to my14 &&
git branch --unset-upstream &&
test_must_fail git config branch.master.remote &&
test_must_fail git config branch.master.merge &&
test_must_fail git config branch.main.remote &&
test_must_fail git config branch.main.merge &&
# fail for a branch without upstream set
echo "fatal: Branch '"'"'master'"'"' has no upstream information" >expect &&
echo "fatal: Branch '"'"'main'"'"' has no upstream information" >expect &&
test_expect_success '--set-upstream-to notices an error to set branch as own upstream' '
@ -959,32 +959,32 @@ test_expect_success '--set-upstream-to notices an error to set branch as own ups
@@ -959,32 +959,32 @@ test_expect_success '--set-upstream-to notices an error to set branch as own ups
# Keep this test last, as it changes the current branch
cat >expect <<EOF
$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from main
EOF
test_expect_success 'git checkout -b g/h/i -l should create a branch and a log' '
GIT_COMMITTER_DATE="2005-05-26 23:30" \
git checkout -b g/h/i -l master &&
git checkout -b g/h/i -l main &&
test_path_is_file .git/refs/heads/g/h/i &&
test_path_is_file .git/logs/refs/heads/g/h/i &&
test_cmp expect .git/logs/refs/heads/g/h/i
'
test_expect_success 'checkout -b makes reflog by default' '
git checkout master &&
git checkout main &&
git config --unset core.logAllRefUpdates &&
git checkout -b alpha &&
git rev-parse --verify alpha@{0}
'
test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates = false' '
git checkout master &&
git checkout main &&
git config core.logAllRefUpdates false &&
git checkout -b beta &&
test_must_fail git rev-parse --verify beta@{0}
'
test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates = false' '
git checkout master &&
git checkout main &&
git checkout -lb gamma &&
git config --unset core.logAllRefUpdates &&
git rev-parse --verify gamma@{0}
@ -993,10 +993,10 @@ test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates
@@ -993,10 +993,10 @@ test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates
@ -1052,10 +1052,10 @@ test_expect_success 'autosetuprebase local on a tracked remote branch' '
@@ -1052,10 +1052,10 @@ test_expect_success 'autosetuprebase local on a tracked remote branch' '
test "$(git config branch.myr5.remote)" = local &&
test "$(git config branch.myr5.merge)" = refs/heads/master &&
test "$(git config branch.myr5.merge)" = refs/heads/main &&
! test "$(git config branch.myr5.rebase)" = true
'
@ -1063,10 +1063,10 @@ test_expect_success 'autosetuprebase never on a tracked remote branch' '
@@ -1063,10 +1063,10 @@ test_expect_success 'autosetuprebase never on a tracked remote branch' '
test "$(git config branch.myr9.remote)" = local &&
test "$(git config branch.myr9.merge)" = refs/heads/master &&
test "$(git config branch.myr9.merge)" = refs/heads/main &&
test "z$(git config branch.myr9.rebase)" = z
'
@ -1117,7 +1117,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '
@@ -1117,7 +1117,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '
test_expect_success 'autosetuprebase unconfigured on untracked local branch' '
@ -1138,7 +1138,7 @@ test_expect_success 'autosetuprebase never on an untracked local branch' '
@@ -1138,7 +1138,7 @@ test_expect_success 'autosetuprebase never on an untracked local branch' '
@ -1149,7 +1149,7 @@ test_expect_success 'autosetuprebase local on an untracked local branch' '
@@ -1149,7 +1149,7 @@ test_expect_success 'autosetuprebase local on an untracked local branch' '
@ -1160,7 +1160,7 @@ test_expect_success 'autosetuprebase remote on an untracked local branch' '
@@ -1160,7 +1160,7 @@ test_expect_success 'autosetuprebase remote on an untracked local branch' '
@ -1171,7 +1171,7 @@ test_expect_success 'autosetuprebase always on an untracked local branch' '
@@ -1171,7 +1171,7 @@ test_expect_success 'autosetuprebase always on an untracked local branch' '
@ -1182,8 +1182,8 @@ test_expect_success 'autosetuprebase never on an untracked remote branch' '
@@ -1182,8 +1182,8 @@ test_expect_success 'autosetuprebase never on an untracked remote branch' '
@ -1193,8 +1193,8 @@ test_expect_success 'autosetuprebase local on an untracked remote branch' '
@@ -1193,8 +1193,8 @@ test_expect_success 'autosetuprebase local on an untracked remote branch' '
@ -1224,7 +1224,7 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' '
@@ -1224,7 +1224,7 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' '
test_expect_success 'autosetuprebase always on detached HEAD' '
git config branch.autosetupmerge always &&
test_when_finished git checkout master &&
test_when_finished git checkout main &&
git checkout HEAD^0 &&
git branch my11 &&
test -z "$(git config branch.my11.remote)" &&
@ -1252,18 +1252,18 @@ test_expect_success 'attempt to delete a branch without base and unmerged to HEA
@@ -1252,18 +1252,18 @@ test_expect_success 'attempt to delete a branch without base and unmerged to HEA
test_expect_success 'attempt to delete a branch merged to its base' '
# we are on my9 which is the initial commit; traditionally
# we would not have allowed deleting my8 that is not merged
# to my9, but it is set to track master that already has my8
git config branch.my8.merge refs/heads/master &&
# to my9, but it is set to track main that already has my8
git config branch.my8.merge refs/heads/main &&
git branch -d my8
'
test_expect_success 'attempt to delete a branch merged to its base' '
git checkout master &&
git checkout main &&
echo Third >>A &&
git commit -m "Third commit" A &&
git branch -t my10 my9 &&
git branch -f my10 HEAD^ &&
# we are on master which is at the third commit, and my10
# we are on main which is at the third commit, and my10
# is behind us, so traditionally we would have allowed deleting
# it; but my10 is set to track my9 that is further behind.
test_must_fail git branch -d my10
@ -1290,7 +1290,7 @@ test_expect_success 'detect typo in branch name when using --edit-description' '
@@ -1290,7 +1290,7 @@ test_expect_success 'detect typo in branch name when using --edit-description' '
'
test_expect_success 'refuse --edit-description on unborn branch for now' '
@ -175,11 +175,11 @@ test_expect_success 'Assert that --contains only works on commits, not trees & b
@@ -175,11 +175,11 @@ test_expect_success 'Assert that --contains only works on commits, not trees & b
test_expect_success 'git branch shows detached HEAD properly after checkout --detach' '
git checkout master &&
git checkout main &&
cat >expect <<EOF &&
* (HEAD detached at $(git rev-parse --short HEAD^0))
branch-one
branch-two
master
main
EOF
git checkout --detach &&
git branch >actual &&
@ -180,7 +180,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving' '
@@ -180,7 +180,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving' '
* (HEAD detached from $(git rev-parse --short HEAD))
branch-one
branch-two
master
main
EOF
git reset --hard HEAD^1 &&
git branch >actual &&
@ -192,9 +192,9 @@ test_expect_success 'git branch shows detached HEAD properly from tag' '
@@ -192,9 +192,9 @@ test_expect_success 'git branch shows detached HEAD properly from tag' '
* (HEAD detached at fromtag)
branch-one
branch-two
master
main
EOF
git tag fromtag master &&
git tag fromtag main &&
git checkout fromtag &&
git branch >actual &&
test_i18ncmp expect actual
@ -205,7 +205,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving from t
@@ -205,7 +205,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving from t
@ -6,7 +6,7 @@ Branch name arguments are usually names which are taken to be inside of
@@ -6,7 +6,7 @@ Branch name arguments are usually names which are taken to be inside of
refs/heads/, but we interpret some magic syntax like @{-1}, @{upstream}, etc.
This script aims to check the behavior of those corner cases.
'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
@ -31,7 +31,7 @@ test_expect_success 'update branch via @{-1}' '
@@ -31,7 +31,7 @@ test_expect_success 'update branch via @{-1}' '
git branch previous one &&
git checkout previous &&
git checkout master &&
git checkout main &&
git branch -f @{-1} two &&
expect_branch previous two
@ -61,7 +61,7 @@ test_expect_success 'delete branch via @{-1}' '
@@ -61,7 +61,7 @@ test_expect_success 'delete branch via @{-1}' '
@ -598,7 +598,7 @@ test_expect_success 'format-patch --range-diff does not compare notes by default
@@ -598,7 +598,7 @@ test_expect_success 'format-patch --range-diff does not compare notes by default
@ -9,7 +9,7 @@ test_description='git pack-refs should not change the branch semantic
@@ -9,7 +9,7 @@ test_description='git pack-refs should not change the branch semantic
This test runs git pack-refs and git show-ref and checks that the branch
@ -1295,11 +1295,11 @@ test_expect_success 'git notes copy diagnoses too many or too few parameters' '
@@ -1295,11 +1295,11 @@ test_expect_success 'git notes copy diagnoses too many or too few parameters' '
test_i18ngrep "too many parameters" error
'
test_expect_success 'git notes get-ref expands refs/heads/master to refs/notes/refs/heads/master' '
test_expect_success 'git notes get-ref expands refs/heads/main to refs/notes/refs/heads/main' '
@ -108,7 +108,7 @@ test_expect_success 'fail to merge into various non-notes refs' '
@@ -108,7 +108,7 @@ test_expect_success 'fail to merge into various non-notes refs' '
git update-ref refs/notes/dir/foo HEAD &&
test_must_fail git -c "core.notesRef=refs/notes/dir" notes merge x &&
test_must_fail git -c "core.notesRef=refs/notes/dir/" notes merge x &&
test_must_fail git -c "core.notesRef=refs/heads/master" notes merge x &&
test_must_fail git -c "core.notesRef=refs/heads/main" notes merge x &&
test_must_fail git -c "core.notesRef=refs/notes/y:" notes merge x &&
test_must_fail git -c "core.notesRef=refs/notes/y:foo" notes merge x &&
test_must_fail git -c "core.notesRef=refs/notes/foo^{bar" notes merge x