t55[23]*: adjust the references to the default branch name "main"
Carefully excluding t5526, which sees independent development elsewhere
at the time of writing, we use `main` as the default branch name in
t55[23]*. This trick was performed via
$ (cd t &&
sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
-e 's/Master/Main/g' -e 's/naster/nain/g' -- \
t55[23]*.sh &&
git checkout HEAD -- t5526\*)
Note that t5533 contains a variation of the name `master` (`naster`)
that we rename here, too.
This commit allows us to define
`GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main` for that range of 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
@ -51,11 +51,11 @@ test_expect_success 'pulling into void' '
@@ -51,11 +51,11 @@ test_expect_success 'pulling into void' '
test_cmp file cloned/file
'
test_expect_success 'pulling into void using master:master' '
test_expect_success 'pulling into void using main:main' '
git init cloned-uho &&
(
cd cloned-uho &&
git pull .. master:master
git pull .. main:main
) &&
test_path_is_file file &&
test_path_is_file cloned-uho/file &&
@ -67,7 +67,7 @@ test_expect_success 'pulling into void does not overwrite untracked files' '
@@ -67,7 +67,7 @@ test_expect_success 'pulling into void does not overwrite untracked files' '
(
cd cloned-untracked &&
echo untracked >file &&
test_must_fail git pull .. master &&
test_must_fail git pull .. main &&
echo untracked >expect &&
test_cmp expect file
)
@ -79,7 +79,7 @@ test_expect_success 'pulling into void does not overwrite staged files' '
@@ -79,7 +79,7 @@ test_expect_success 'pulling into void does not overwrite staged files' '
cd cloned-staged-colliding &&
echo "alternate content" >file &&
git add file &&
test_must_fail git pull .. master &&
test_must_fail git pull .. main &&
echo "alternate content" >expect &&
test_cmp expect file &&
git cat-file blob :file >file.index &&
@ -93,7 +93,7 @@ test_expect_success 'pulling into void does not remove new staged files' '
@@ -93,7 +93,7 @@ test_expect_success 'pulling into void does not remove new staged files' '
cd cloned-staged-new &&
echo "new tracked file" >newfile &&
git add newfile &&
git pull .. master &&
git pull .. main &&
echo "new tracked file" >expect &&
test_cmp expect newfile &&
git cat-file blob :newfile >newfile.index &&
@ -105,15 +105,15 @@ test_expect_success 'pulling into void must not create an octopus' '
@@ -105,15 +105,15 @@ test_expect_success 'pulling into void must not create an octopus' '
git init cloned-octopus &&
(
cd cloned-octopus &&
test_must_fail git pull .. master master &&
test_must_fail git pull .. main main &&
test_path_is_missing file
)
'
test_expect_success 'test . as a remote' '
git branch copy master &&
git branch copy main &&
git config branch.copy.remote . &&
git config branch.copy.merge refs/heads/master &&
git config branch.copy.merge refs/heads/main &&
echo updated >file &&
git commit -a -m updated &&
git checkout copy &&
@ -129,7 +129,7 @@ test_expect_success 'test . as a remote' '
@@ -129,7 +129,7 @@ test_expect_success 'test . as a remote' '
'
test_expect_success 'the default remote . should not break explicit pull' '
test_must_fail git pull --rebase . copy main 2>err &&
test_cmp_rev HEAD before-rebase &&
test_i18ngrep "Cannot rebase onto multiple branches" err &&
echo modified >expect &&
@ -503,7 +503,7 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '
@@ -503,7 +503,7 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '
test_i18ngrep ! "verify-signatures" err
'
# add a feature branch, keep-merge, that is merged into master, so the
# add a feature branch, keep-merge, that is merged into main, so the
# test can try preserving the merge commit (or not) with various
# --rebase flags/pull.rebase settings.
test_expect_success 'preserve merge setup' '
@ -702,12 +702,12 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '
@@ -702,12 +702,12 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '
'
test_expect_success 'pull --rebase works on branch yet to be born' '
git rev-parse master >expect &&
git rev-parse main >expect &&
mkdir empty_repo &&
(
cd empty_repo &&
git init &&
git pull --rebase .. master &&
git pull --rebase .. main &&
git rev-parse HEAD >../actual
) &&
test_cmp expect actual
@ -723,7 +723,7 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '
@@ -723,7 +723,7 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '
test_terminal git push -u upstream main >out 2>err &&
test_i18ngrep "Writing objects" err
'
@ -85,7 +85,7 @@ test_expect_success 'progress messages do not go to non-tty' '
@@ -85,7 +85,7 @@ test_expect_success 'progress messages do not go to non-tty' '
ensure_fresh_upstream &&
# skip progress messages, since stderr is non-tty
git push -u upstream master >out 2>err &&
git push -u upstream main >out 2>err &&
test_i18ngrep ! "Writing objects" err
'
@ -93,21 +93,21 @@ test_expect_success 'progress messages go to non-tty (forced)' '
@@ -93,21 +93,21 @@ test_expect_success 'progress messages go to non-tty (forced)' '
ensure_fresh_upstream &&
# force progress messages to stderr, even though it is non-tty
@ -36,7 +36,7 @@ test_expect_success 'try to create repo with absurdly long refname' '
@@ -36,7 +36,7 @@ test_expect_success 'try to create repo with absurdly long refname' '
(
cd long &&
test_commit long &&
test_commit master
test_commit main
) &&
if git -C long update-ref refs/heads/$ref1440 long; then
test_expect_success '"upstream" pushes to configured upstream' '
git checkout master &&
test_config branch.master.remote parent1 &&
test_config branch.master.merge refs/heads/foo &&
git checkout main &&
test_config branch.main.remote parent1 &&
test_config branch.main.merge refs/heads/foo &&
test_commit two &&
test_push_success upstream foo
'
test_expect_success '"upstream" does not push on unconfigured remote' '
git checkout master &&
test_unconfig branch.master.remote &&
git checkout main &&
test_unconfig branch.main.remote &&
test_commit three &&
test_push_failure upstream
'
test_expect_success '"upstream" does not push on unconfigured branch' '
git checkout master &&
test_config branch.master.remote parent1 &&
test_unconfig branch.master.merge &&
git checkout main &&
test_config branch.main.remote parent1 &&
test_unconfig branch.main.merge &&
test_commit four &&
test_push_failure upstream
'
test_expect_success '"upstream" does not push when remotes do not match' '
git checkout master &&
test_config branch.master.remote parent1 &&
test_config branch.master.merge refs/heads/foo &&
git checkout main &&
test_config branch.main.remote parent1 &&
test_config branch.main.merge refs/heads/foo &&
test_config push.default upstream &&
test_commit five &&
test_must_fail git push parent2
@ -124,99 +124,99 @@ test_expect_success 'push from/to new branch with current creates remote branch'
@@ -124,99 +124,99 @@ test_expect_success 'push from/to new branch with current creates remote branch'
'
test_expect_success 'push to existing branch, with no upstream configured' '
test_config branch.master.remote repo1 &&
git checkout master &&
test_config branch.main.remote repo1 &&
git checkout main &&
test_push_failure simple &&
test_push_failure upstream
'
test_expect_success 'push to existing branch, upstream configured with same name' '
git push --recurse-submodules=check ../pub.git main
)
'
@ -69,21 +69,21 @@ test_expect_success 'push fails if submodule commit not on remote' '
@@ -69,21 +69,21 @@ test_expect_success 'push fails if submodule commit not on remote' '
git commit -m "Third commit for gar/bage" &&
# the push should fail with --recurse-submodules=check
git push --recurse-submodules=check ../pub.git main
)
'
@ -98,13 +98,13 @@ test_expect_success 'push succeeds if submodule commit not on remote but using o
@@ -98,13 +98,13 @@ test_expect_success 'push succeeds if submodule commit not on remote but using o
cd work &&
git add gar/bage &&
git commit -m "Recurse on-demand on command line for gar/bage" &&
git push --recurse-submodules=on-demand ../pub.git main &&
# Check that the supermodule commit got there
git fetch ../pub.git &&
git diff --quiet FETCH_HEAD master &&
git diff --quiet FETCH_HEAD main &&
# Check that the submodule commit got there too
cd gar/bage &&
git diff --quiet origin/master master
git diff --quiet origin/main main
)
'
@ -119,13 +119,13 @@ test_expect_success 'push succeeds if submodule commit not on remote but using o
@@ -119,13 +119,13 @@ test_expect_success 'push succeeds if submodule commit not on remote but using o
cd work &&
git add gar/bage &&
git commit -m "Recurse on-demand from config for gar/bage" &&
git -c push.recurseSubmodules=on-demand push ../pub.git main &&
# Check that the supermodule commit got there
git fetch ../pub.git &&
git diff --quiet FETCH_HEAD master &&
git diff --quiet FETCH_HEAD main &&
# Check that the submodule commit got there too
cd gar/bage &&
git diff --quiet origin/master master
git diff --quiet origin/main main
)
'
@ -140,13 +140,13 @@ test_expect_success 'push succeeds if submodule commit not on remote but using a
@@ -140,13 +140,13 @@ test_expect_success 'push succeeds if submodule commit not on remote but using a
cd work &&
git add gar/bage &&
git commit -m "Recurse submodule.recurse from config for gar/bage" &&
@ -208,31 +208,31 @@ test_expect_success 'push recurse-submodules last one wins on command line' '
@@ -208,31 +208,31 @@ test_expect_success 'push recurse-submodules last one wins on command line' '
git commit -m "Recurse on command-line overriding earlier command-line for gar/bage" &&
@ -247,13 +247,13 @@ test_expect_success 'push succeeds if submodule commit not on remote using on-de
@@ -247,13 +247,13 @@ test_expect_success 'push succeeds if submodule commit not on remote using on-de
cd work &&
git add gar/bage &&
git commit -m "Recurse on-demand on command-line overriding config for gar/bage" &&
git push --recurse-submodules=on-demand ../pub.git main
)
'
@ -307,7 +307,7 @@ test_expect_success 'submodule entry pointing at a tag is error' '
@@ -307,7 +307,7 @@ test_expect_success 'submodule entry pointing at a tag is error' '
git -C work update-index --cacheinfo 160000 "$tag" gar/bage &&
git -C work commit -m "bad commit" &&
test_when_finished "git -C work reset --hard HEAD^" &&
test_must_fail git -C work push --recurse-submodules=on-demand ../pub.git master 2>err &&
test_must_fail git -C work push --recurse-submodules=on-demand ../pub.git main 2>err &&
test_i18ngrep "is a tag, not a commit" err
'
@ -322,9 +322,9 @@ test_expect_success 'push fails if recurse submodules option passed as yes' '
@@ -322,9 +322,9 @@ test_expect_success 'push fails if recurse submodules option passed as yes' '
cd work &&
git add gar/bage &&
git commit -m "Recurse push fails if recurse submodules option passed as yes for gar/bage" &&
test_must_fail git push --recurse-submodules=yes ../pub.git main &&
test_must_fail git -c push.recurseSubmodules=yes push ../pub.git main &&
git push --recurse-submodules=on-demand ../pub.git main
)
'
@ -366,7 +366,7 @@ test_expect_success 'push succeeds if submodule has no remote and is on the firs
@@ -366,7 +366,7 @@ test_expect_success 'push succeeds if submodule has no remote and is on the firs
) &&
git add b &&
git commit -m "added submodule" &&
git push --recurse-submodules=check origin master
git push --recurse-submodules=check origin main
)
'
@ -375,21 +375,21 @@ test_expect_success 'push unpushed submodules when not needed' '
@@ -375,21 +375,21 @@ test_expect_success 'push unpushed submodules when not needed' '
git -C submodule.git rev-parse main >actual_submodule &&
git -C pub.git rev-parse main >actual_pub &&
test_cmp expected_submodule actual_submodule &&
test_cmp expected_pub actual_pub
'
@ -520,14 +520,14 @@ test_expect_success 'push propagating the remotes name to a submodule' '
@@ -520,14 +520,14 @@ test_expect_success 'push propagating the remotes name to a submodule' '
git -C work commit -m "Tenth junk added to gar/bage" &&
# Fails when submodule does not have a matching remote
test_must_fail git -C work push --recurse-submodules=on-demand pub master &&
test_must_fail git -C work push --recurse-submodules=on-demand pub main &&
# Succeeds when submodules has matching remote and refspec
git -C work push --recurse-submodules=on-demand origin master &&
git -C work push --recurse-submodules=on-demand origin main &&
git push --force-with-lease=main origin main 2>err &&
! grep "forced update" err
) &&
git ls-remote dst refs/heads/master >expect &&
git ls-remote src refs/heads/master >actual &&
git ls-remote dst refs/heads/main >expect &&
git ls-remote src refs/heads/main >actual &&
test_cmp expect actual
'
@ -160,22 +160,22 @@ test_expect_success 'push to update (allowed even though no-ff)' '
@@ -160,22 +160,22 @@ test_expect_success 'push to update (allowed even though no-ff)' '
@ -280,7 +280,7 @@ test_expect_success 'background updates of REMOTE can be mitigated with a non-up
@@ -280,7 +280,7 @@ test_expect_success 'background updates of REMOTE can be mitigated with a non-up
cd dst &&
test_commit G &&
git remote add origin-push ../src.bare &&
git push origin-push master:master
git push origin-push main:main
) &&
git clone --no-local src.bare dst2 &&
test_when_finished "rm -rf dst2" &&
@ -302,58 +302,58 @@ test_expect_success 'background updates of REMOTE can be mitigated with a non-up
@@ -302,58 +302,58 @@ test_expect_success 'background updates of REMOTE can be mitigated with a non-up
test_expect_success 'background updates to remote can be mitigated with "--force-if-includes"' '
test_expect_success '"--force-if-includes" should allow forced update after a rebase ("pull --rebase")' '
@ -363,10 +363,10 @@ test_expect_success '"--force-if-includes" should allow forced update after a re
@@ -363,10 +363,10 @@ test_expect_success '"--force-if-includes" should allow forced update after a re
@ -377,11 +377,11 @@ test_expect_success '"--force-if-includes" should allow forced update after a re
@@ -377,11 +377,11 @@ test_expect_success '"--force-if-includes" should allow forced update after a re
@ -92,7 +92,7 @@ test_expect_success 'fetch --unshallow from a full clone' '
@@ -92,7 +92,7 @@ test_expect_success 'fetch --unshallow from a full clone' '
@ -107,9 +107,9 @@ test_expect_success 'fetch something upstream has but hidden by clients shallow
@@ -107,9 +107,9 @@ test_expect_success 'fetch something upstream has but hidden by clients shallow
@ -138,7 +138,7 @@ test_expect_success 'fetch that requires changes in .git/shallow is filtered' '
@@ -138,7 +138,7 @@ test_expect_success 'fetch that requires changes in .git/shallow is filtered' '