t5505: finalize transitioning to using the branch name `main`
In 66713e84e7 (tests: prepare aligned mentions of the default branch
name, 2020-10-23), we started that transition, trying to prepare for a
time when `git init` would use that name for the initial branch.
Even if that time has not arrived, we can complete the transition by
making the test script independent of the default branch name. This also
allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq from four test
cases.
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
@ -60,8 +60,8 @@ test_expect_success C_LOCALE_OUTPUT 'remote information for the origin' '
@@ -60,8 +60,8 @@ test_expect_success C_LOCALE_OUTPUT 'remote information for the origin' '
(
cd test &&
tokens_match origin "$(git remote)" &&
check_remote_track origin master side &&
check_tracking_branch origin HEAD master side
check_remote_track origin main side &&
check_tracking_branch origin HEAD main side
)
'
@ -70,7 +70,7 @@ test_expect_success 'add another remote' '
@@ -70,7 +70,7 @@ test_expect_success 'add another remote' '
cd test &&
git remote add -f second ../two &&
tokens_match "origin second" "$(git remote)" &&
check_tracking_branch second master side another &&
@ -153,7 +153,7 @@ test_expect_success 'remove errors out early when deleting non-existent branch'
@@ -153,7 +153,7 @@ test_expect_success 'remove errors out early when deleting non-existent branch'
test_expect_success 'remove remote with a branch without configured merge' '
test_when_finished "(
git -C test checkout master;
git -C test checkout main;
git -C test branch -D two;
git -C test config --remove-section remote.two;
git -C test config --remove-section branch.second;
@ -163,9 +163,9 @@ test_expect_success 'remove remote with a branch without configured merge' '
@@ -163,9 +163,9 @@ test_expect_success 'remove remote with a branch without configured merge' '
@ -751,14 +751,14 @@ test_expect_success 'rename a remote' '
@@ -751,14 +751,14 @@ test_expect_success 'rename a remote' '
git clone one four &&
(
cd four &&
git config branch.master.pushRemote origin &&
git config branch.main.pushRemote origin &&
git remote rename origin upstream &&
test -z "$(git for-each-ref refs/remotes/origin)" &&
test "$(git symbolic-ref refs/remotes/upstream/HEAD)" = "refs/remotes/upstream/master" &&
test "$(git rev-parse upstream/master)" = "$(git rev-parse master)" &&
test "$(git symbolic-ref refs/remotes/upstream/HEAD)" = "refs/remotes/upstream/main" &&
test "$(git rev-parse upstream/main)" = "$(git rev-parse main)" &&
test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/remotes/upstream/*" &&
test "$(git config branch.master.remote)" = "upstream" &&
test "$(git config branch.master.pushRemote)" = "upstream" &&
test "$(git config branch.main.remote)" = "upstream" &&
test "$(git config branch.main.pushRemote)" = "upstream" &&
test "$(git config --global remote.pushDefault)" = "origin"
)
'
@ -804,7 +804,7 @@ test_expect_success 'rename does not update a non-default fetch refspec' '
@@ -804,7 +804,7 @@ test_expect_success 'rename does not update a non-default fetch refspec' '
test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/heads/origin/*" &&
git rev-parse -q origin/master
git rev-parse -q origin/main
)
'
@ -824,7 +824,7 @@ test_expect_success 'rename a remote with name prefix of other remote' '
@@ -824,7 +824,7 @@ test_expect_success 'rename a remote with name prefix of other remote' '
cd four.three &&
git remote add o git://example.com/repo.git &&
git remote rename o upstream &&
test "$(git rev-parse origin/master)" = "$(git rev-parse master)"
test "$(git rev-parse origin/main)" = "$(git rev-parse main)"
)
'
@ -840,11 +840,11 @@ test_expect_success 'remove a remote' '
@@ -840,11 +840,11 @@ test_expect_success 'remove a remote' '
git clone one four.five &&
(
cd four.five &&
git config branch.master.pushRemote origin &&
git config branch.main.pushRemote origin &&
git remote remove origin &&
test -z "$(git for-each-ref refs/remotes/origin)" &&
test "$(git config --global remote.pushDefault)" = "origin"
)
'
@ -885,9 +885,9 @@ test_expect_success 'remove a remote removes repo remote.pushDefault but keeps g
@@ -885,9 +885,9 @@ test_expect_success 'remove a remote removes repo remote.pushDefault but keeps g
cat >remotes_origin <<EOF
URL: $(pwd)/one
Push: refs/heads/master:refs/heads/upstream
Push: refs/heads/main:refs/heads/upstream
Push: refs/heads/next:refs/heads/upstream2
Pull: refs/heads/master:refs/heads/origin
Pull: refs/heads/main:refs/heads/origin
Pull: refs/heads/next:refs/heads/origin2
EOF
@ -903,11 +903,11 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
@@ -903,11 +903,11 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
test_path_is_missing .git/remotes/origin &&
test "$(git config remote.origin.url)" = "$origin_url" &&
@ -923,12 +923,12 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
@@ -923,12 +923,12 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
(
cd six &&
git remote rm origin &&
echo "$origin_url" >.git/branches/origin &&
echo "$origin_url#main" >.git/branches/origin &&
git remote rename origin origin &&
test_path_is_missing .git/branches/origin &&
test "$(git config remote.origin.url)" = "$origin_url" &&
test "$(git config remote.origin.fetch)" = "refs/heads/master:refs/heads/origin" &&
test "$(git config remote.origin.push)" = "HEAD:refs/heads/master"
test "$(git config remote.origin.fetch)" = "refs/heads/main:refs/heads/origin" &&
test "$(git config remote.origin.push)" = "HEAD:refs/heads/main"
)
'
@ -951,7 +951,7 @@ test_expect_success 'remote prune to cause a dangling symref' '
@@ -951,7 +951,7 @@ test_expect_success 'remote prune to cause a dangling symref' '