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>
This commit is contained in:

committed by
Junio C Hamano

parent
c2fdc8820c
commit
06d531486e
@ -134,18 +134,18 @@ valid_ref !MINGW "$ref" '--refspec-pattern --allow-onelevel --normalize'
|
||||
test_expect_success "check-ref-format --branch @{-1}" '
|
||||
T=$(git write-tree) &&
|
||||
sha1=$(echo A | git commit-tree $T) &&
|
||||
git update-ref refs/heads/master $sha1 &&
|
||||
git update-ref refs/remotes/origin/master $sha1 &&
|
||||
git checkout master &&
|
||||
git checkout origin/master &&
|
||||
git checkout master &&
|
||||
git update-ref refs/heads/main $sha1 &&
|
||||
git update-ref refs/remotes/origin/main $sha1 &&
|
||||
git checkout main &&
|
||||
git checkout origin/main &&
|
||||
git checkout main &&
|
||||
refname=$(git check-ref-format --branch @{-1}) &&
|
||||
test "$refname" = "$sha1" &&
|
||||
refname2=$(git check-ref-format --branch @{-2}) &&
|
||||
test "$refname2" = master'
|
||||
test "$refname2" = main'
|
||||
|
||||
test_expect_success 'check-ref-format --branch -naster' '
|
||||
test_must_fail git check-ref-format --branch -naster >actual &&
|
||||
test_expect_success 'check-ref-format --branch -nain' '
|
||||
test_must_fail git check-ref-format --branch -nain >actual &&
|
||||
test_must_be_empty actual
|
||||
'
|
||||
|
||||
@ -154,11 +154,11 @@ test_expect_success 'check-ref-format --branch from subdir' '
|
||||
|
||||
T=$(git write-tree) &&
|
||||
sha1=$(echo A | git commit-tree $T) &&
|
||||
git update-ref refs/heads/master $sha1 &&
|
||||
git update-ref refs/remotes/origin/master $sha1 &&
|
||||
git checkout master &&
|
||||
git checkout origin/master &&
|
||||
git checkout master &&
|
||||
git update-ref refs/heads/main $sha1 &&
|
||||
git update-ref refs/remotes/origin/main $sha1 &&
|
||||
git checkout main &&
|
||||
git checkout origin/main &&
|
||||
git checkout main &&
|
||||
refname=$(
|
||||
cd subdir &&
|
||||
git check-ref-format --branch @{-1}
|
||||
@ -171,9 +171,9 @@ test_expect_success 'check-ref-format --branch @{-1} from non-repo' '
|
||||
test_must_be_empty actual
|
||||
'
|
||||
|
||||
test_expect_success 'check-ref-format --branch master from non-repo' '
|
||||
echo master >expect &&
|
||||
nongit git check-ref-format --branch master >actual &&
|
||||
test_expect_success 'check-ref-format --branch main from non-repo' '
|
||||
echo main >expect &&
|
||||
nongit git check-ref-format --branch main >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
|
Reference in New Issue
Block a user