summaryrefslogtreecommitdiff
path: root/t/t1430-bad-ref-name.sh
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2020-11-18 23:44:21 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-11-19 15:44:18 -0800
commit06d531486e9078c88c324ad6f87376cfa897f058 (patch)
treec3ed8ffad4583e9bd1e717c782dc8b20784f2d91 /t/t1430-bad-ref-name.sh
parentt0060: preemptively adjust alignment (diff)
downloadtgif-06d531486e9078c88c324ad6f87376cfa897f058.tar.xz
t[01]*: adjust the references to the default branch name "main"
Carefully excluding t1309, 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' -e 's/naster/nain/g' -- t[01]*.sh && git checkout HEAD -- t1309\*) Note that t5533 contains a variation of the name `master` (`naster`) that we rename here, too. This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main` for those tests. Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1430-bad-ref-name.sh')
-rwxr-xr-xt/t1430-bad-ref-name.sh54
1 files changed, 27 insertions, 27 deletions
diff --git a/t/t1430-bad-ref-name.sh b/t/t1430-bad-ref-name.sh
index 8c4353746b..354902e514 100755
--- a/t/t1430-bad-ref-name.sh
+++ b/t/t1430-bad-ref-name.sh
@@ -1,7 +1,7 @@
#!/bin/sh
test_description='Test handling of ref names that check-ref-format rejects'
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
@@ -20,7 +20,7 @@ test_expect_success 'fast-import: fail on invalid branch name ".badbranchname"'
corrupt
COMMIT
- from refs/heads/master
+ from refs/heads/main
INPUT_END
test_must_fail git fast-import <input
@@ -35,14 +35,14 @@ test_expect_success 'fast-import: fail on invalid branch name "bad[branch]name"'
corrupt
COMMIT
- from refs/heads/master
+ from refs/heads/main
INPUT_END
test_must_fail git fast-import <input
'
test_expect_success 'git branch shows badly named ref as warning' '
- cp .git/refs/heads/master .git/refs/heads/broken...ref &&
+ cp .git/refs/heads/main .git/refs/heads/broken...ref &&
test_when_finished "rm -f .git/refs/heads/broken...ref" &&
git branch >output 2>error &&
test_i18ngrep -e "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
@@ -50,7 +50,7 @@ test_expect_success 'git branch shows badly named ref as warning' '
'
test_expect_success 'branch -d can delete badly named ref' '
- cp .git/refs/heads/master .git/refs/heads/broken...ref &&
+ cp .git/refs/heads/main .git/refs/heads/broken...ref &&
test_when_finished "rm -f .git/refs/heads/broken...ref" &&
git branch -d broken...ref &&
git branch >output 2>error &&
@@ -59,7 +59,7 @@ test_expect_success 'branch -d can delete badly named ref' '
'
test_expect_success 'branch -D can delete badly named ref' '
- cp .git/refs/heads/master .git/refs/heads/broken...ref &&
+ cp .git/refs/heads/main .git/refs/heads/broken...ref &&
test_when_finished "rm -f .git/refs/heads/broken...ref" &&
git branch -D broken...ref &&
git branch >output 2>error &&
@@ -101,17 +101,17 @@ test_expect_success 'branch -m cannot rename to a bad ref name' '
test_might_fail git branch -D goodref &&
git branch goodref &&
test_must_fail git branch -m goodref broken...ref &&
- test_cmp_rev master goodref &&
+ test_cmp_rev main goodref &&
git branch >output 2>error &&
! grep -e "broken\.\.\.ref" error &&
! grep -e "broken\.\.\.ref" output
'
test_expect_failure 'branch -m can rename from a bad ref name' '
- cp .git/refs/heads/master .git/refs/heads/broken...ref &&
+ cp .git/refs/heads/main .git/refs/heads/broken...ref &&
test_when_finished "rm -f .git/refs/heads/broken...ref" &&
git branch -m broken...ref renamed &&
- test_cmp_rev master renamed &&
+ test_cmp_rev main renamed &&
git branch >output 2>error &&
! grep -e "broken\.\.\.ref" error &&
! grep -e "broken\.\.\.ref" output
@@ -138,7 +138,7 @@ test_expect_failure C_LOCALE_OUTPUT 'push --mirror can delete badly named ref' '
cd dest &&
test_commit two &&
git checkout --detach &&
- cp .git/refs/heads/master .git/refs/heads/broken...ref
+ cp .git/refs/heads/main .git/refs/heads/broken...ref
) &&
git -C src push --mirror "file://$top/dest" &&
git -C dest branch >output 2>error &&
@@ -149,7 +149,7 @@ test_expect_failure C_LOCALE_OUTPUT 'push --mirror can delete badly named ref' '
test_expect_success 'rev-parse skips symref pointing to broken name' '
test_when_finished "rm -f .git/refs/heads/broken...ref" &&
git branch shadow one &&
- cp .git/refs/heads/master .git/refs/heads/broken...ref &&
+ cp .git/refs/heads/main .git/refs/heads/broken...ref &&
printf "ref: refs/heads/broken...ref\n" >.git/refs/tags/shadow &&
test_when_finished "rm -f .git/refs/tags/shadow" &&
git rev-parse --verify one >expect &&
@@ -159,11 +159,11 @@ test_expect_success 'rev-parse skips symref pointing to broken name' '
'
test_expect_success 'for-each-ref emits warnings for broken names' '
- cp .git/refs/heads/master .git/refs/heads/broken...ref &&
+ cp .git/refs/heads/main .git/refs/heads/broken...ref &&
test_when_finished "rm -f .git/refs/heads/broken...ref" &&
printf "ref: refs/heads/broken...ref\n" >.git/refs/heads/badname &&
test_when_finished "rm -f .git/refs/heads/badname" &&
- printf "ref: refs/heads/master\n" >.git/refs/heads/broken...symref &&
+ printf "ref: refs/heads/main\n" >.git/refs/heads/broken...symref &&
test_when_finished "rm -f .git/refs/heads/broken...symref" &&
git for-each-ref >output 2>error &&
! grep -e "broken\.\.\.ref" output &&
@@ -175,7 +175,7 @@ test_expect_success 'for-each-ref emits warnings for broken names' '
'
test_expect_success 'update-ref -d can delete broken name' '
- cp .git/refs/heads/master .git/refs/heads/broken...ref &&
+ cp .git/refs/heads/main .git/refs/heads/broken...ref &&
test_when_finished "rm -f .git/refs/heads/broken...ref" &&
git update-ref -d refs/heads/broken...ref >output 2>error &&
test_must_be_empty output &&
@@ -186,7 +186,7 @@ test_expect_success 'update-ref -d can delete broken name' '
'
test_expect_success 'branch -d can delete broken name' '
- cp .git/refs/heads/master .git/refs/heads/broken...ref &&
+ cp .git/refs/heads/main .git/refs/heads/broken...ref &&
test_when_finished "rm -f .git/refs/heads/broken...ref" &&
git branch -d broken...ref >output 2>error &&
test_i18ngrep "Deleted branch broken...ref (was broken)" output &&
@@ -197,7 +197,7 @@ test_expect_success 'branch -d can delete broken name' '
'
test_expect_success 'update-ref --no-deref -d can delete symref to broken name' '
- cp .git/refs/heads/master .git/refs/heads/broken...ref &&
+ cp .git/refs/heads/main .git/refs/heads/broken...ref &&
test_when_finished "rm -f .git/refs/heads/broken...ref" &&
printf "ref: refs/heads/broken...ref\n" >.git/refs/heads/badname &&
test_when_finished "rm -f .git/refs/heads/badname" &&
@@ -208,7 +208,7 @@ test_expect_success 'update-ref --no-deref -d can delete symref to broken name'
'
test_expect_success 'branch -d can delete symref to broken name' '
- cp .git/refs/heads/master .git/refs/heads/broken...ref &&
+ cp .git/refs/heads/main .git/refs/heads/broken...ref &&
test_when_finished "rm -f .git/refs/heads/broken...ref" &&
printf "ref: refs/heads/broken...ref\n" >.git/refs/heads/badname &&
test_when_finished "rm -f .git/refs/heads/badname" &&
@@ -237,7 +237,7 @@ test_expect_success 'branch -d can delete dangling symref to broken name' '
'
test_expect_success 'update-ref -d can delete broken name through symref' '
- cp .git/refs/heads/master .git/refs/heads/broken...ref &&
+ cp .git/refs/heads/main .git/refs/heads/broken...ref &&
test_when_finished "rm -f .git/refs/heads/broken...ref" &&
printf "ref: refs/heads/broken...ref\n" >.git/refs/heads/badname &&
test_when_finished "rm -f .git/refs/heads/badname" &&
@@ -248,7 +248,7 @@ test_expect_success 'update-ref -d can delete broken name through symref' '
'
test_expect_success 'update-ref --no-deref -d can delete symref with broken name' '
- printf "ref: refs/heads/master\n" >.git/refs/heads/broken...symref &&
+ printf "ref: refs/heads/main\n" >.git/refs/heads/broken...symref &&
test_when_finished "rm -f .git/refs/heads/broken...symref" &&
git update-ref --no-deref -d refs/heads/broken...symref >output 2>error &&
test_path_is_missing .git/refs/heads/broken...symref &&
@@ -257,11 +257,11 @@ test_expect_success 'update-ref --no-deref -d can delete symref with broken name
'
test_expect_success 'branch -d can delete symref with broken name' '
- printf "ref: refs/heads/master\n" >.git/refs/heads/broken...symref &&
+ printf "ref: refs/heads/main\n" >.git/refs/heads/broken...symref &&
test_when_finished "rm -f .git/refs/heads/broken...symref" &&
git branch -d broken...symref >output 2>error &&
test_path_is_missing .git/refs/heads/broken...symref &&
- test_i18ngrep "Deleted branch broken...symref (was refs/heads/master)" output &&
+ test_i18ngrep "Deleted branch broken...symref (was refs/heads/main)" output &&
test_must_be_empty error
'
@@ -299,37 +299,37 @@ test_expect_success 'update-ref -d cannot delete absolute path' '
'
test_expect_success 'update-ref --stdin fails create with bad ref name' '
- echo "create ~a refs/heads/master" >stdin &&
+ echo "create ~a refs/heads/main" >stdin &&
test_must_fail git update-ref --stdin <stdin 2>err &&
grep "fatal: invalid ref format: ~a" err
'
test_expect_success 'update-ref --stdin fails update with bad ref name' '
- echo "update ~a refs/heads/master" >stdin &&
+ echo "update ~a refs/heads/main" >stdin &&
test_must_fail git update-ref --stdin <stdin 2>err &&
grep "fatal: invalid ref format: ~a" err
'
test_expect_success 'update-ref --stdin fails delete with bad ref name' '
- echo "delete ~a refs/heads/master" >stdin &&
+ echo "delete ~a refs/heads/main" >stdin &&
test_must_fail git update-ref --stdin <stdin 2>err &&
grep "fatal: invalid ref format: ~a" err
'
test_expect_success 'update-ref --stdin -z fails create with bad ref name' '
- printf "%s\0" "create ~a " refs/heads/master >stdin &&
+ printf "%s\0" "create ~a " refs/heads/main >stdin &&
test_must_fail git update-ref -z --stdin <stdin 2>err &&
grep "fatal: invalid ref format: ~a " err
'
test_expect_success 'update-ref --stdin -z fails update with bad ref name' '
- printf "%s\0" "update ~a" refs/heads/master "" >stdin &&
+ printf "%s\0" "update ~a" refs/heads/main "" >stdin &&
test_must_fail git update-ref -z --stdin <stdin 2>err &&
grep "fatal: invalid ref format: ~a" err
'
test_expect_success 'update-ref --stdin -z fails delete with bad ref name' '
- printf "%s\0" "delete ~a" refs/heads/master >stdin &&
+ printf "%s\0" "delete ~a" refs/heads/main >stdin &&
test_must_fail git update-ref -z --stdin <stdin 2>err &&
grep "fatal: invalid ref format: ~a" err
'