Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-01-26 01:19:18 +0300
committerJunio C Hamano <gitster@pobox.com>2021-01-26 01:19:18 +0300
commit27d7c8599b159862762e2bd121c22d516fb04e90 (patch)
tree91bed47151791fe2e18e8e9e07a5d58207413bda /t/t5582-fetch-negative-refspec.sh
parent440acfbe0cec5c2316ef7a706c975143c4902b20 (diff)
parent8b70966aa90b52427e1a09329abde8d845f90398 (diff)
Merge branch 'js/default-branch-name-tests-final-stretch'
Prepare tests not to be affected by the name of the default branch "git init" creates. * js/default-branch-name-tests-final-stretch: (28 commits) tests: drop prereq `PREPARE_FOR_MAIN_BRANCH` where no longer needed t99*: adjust the references to the default branch name "main" tests(git-p4): transition to the default branch name `main` t9[5-7]*: adjust the references to the default branch name "main" t9[0-4]*: adjust the references to the default branch name "main" t8*: adjust the references to the default branch name "main" t7[5-9]*: adjust the references to the default branch name "main" t7[0-4]*: adjust the references to the default branch name "main" t6[4-9]*: adjust the references to the default branch name "main" t64*: preemptively adjust alignment to prepare for `master` -> `main` t6[0-3]*: adjust the references to the default branch name "main" t5[6-9]*: adjust the references to the default branch name "main" t55[4-9]*: adjust the references to the default branch name "main" t55[23]*: adjust the references to the default branch name "main" t551*: adjust the references to the default branch name "main" t550*: adjust the references to the default branch name "main" t5503: prepare aligned comment for replacing `master` with `main` t5[0-4]*: adjust the references to the default branch name "main" t5323: prepare centered comment for `master` -> `main` t4*: adjust the references to the default branch name "main" ...
Diffstat (limited to 't/t5582-fetch-negative-refspec.sh')
-rwxr-xr-xt/t5582-fetch-negative-refspec.sh25
1 files changed, 14 insertions, 11 deletions
diff --git a/t/t5582-fetch-negative-refspec.sh b/t/t5582-fetch-negative-refspec.sh
index 2f3b064d0e..f345097277 100755
--- a/t/t5582-fetch-negative-refspec.sh
+++ b/t/t5582-fetch-negative-refspec.sh
@@ -5,6 +5,9 @@ test_description='"git fetch" with negative refspecs.
'
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
. ./test-lib.sh
test_expect_success setup '
@@ -22,12 +25,12 @@ test_expect_success "clone and setup child repos" '
git switch -c alternate &&
echo >file updated again by one &&
git commit -a -m "updated by one again" &&
- git switch master
+ git switch main
) &&
git clone . two &&
(
cd two &&
- git config branch.master.remote one &&
+ git config branch.main.remote one &&
git config remote.one.url ../one/.git/ &&
git config remote.one.fetch +refs/heads/*:refs/remotes/one/* &&
git config --add remote.one.fetch ^refs/heads/alternate
@@ -43,9 +46,9 @@ test_expect_success "fetch one" '
test_must_fail git rev-parse --verify refs/remotes/one/alternate &&
git fetch one &&
test_must_fail git rev-parse --verify refs/remotes/one/alternate &&
- git rev-parse --verify refs/remotes/one/master &&
- mine=$(git rev-parse refs/remotes/one/master) &&
- his=$(cd ../one && git rev-parse refs/heads/master) &&
+ git rev-parse --verify refs/remotes/one/main &&
+ mine=$(git rev-parse refs/remotes/one/main) &&
+ his=$(cd ../one && git rev-parse refs/heads/main) &&
test "z$mine" = "z$his"
)
'
@@ -57,7 +60,7 @@ test_expect_success "fetch with negative refspec on commandline" '
cd three &&
alternate_in_one=$(cd ../one && git rev-parse refs/heads/alternate) &&
echo $alternate_in_one >expect &&
- git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^refs/heads/master &&
+ git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^refs/heads/main &&
cut -f -1 .git/FETCH_HEAD >actual &&
test_cmp expect actual
)
@@ -68,8 +71,8 @@ test_expect_success "fetch with negative sha1 refspec fails" '
git commit -a -m "updated by origin yet again" &&
(
cd three &&
- master_in_one=$(cd ../one && git rev-parse refs/heads/master) &&
- test_must_fail git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^$master_in_one
+ main_in_one=$(cd ../one && git rev-parse refs/heads/main) &&
+ test_must_fail git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^$main_in_one
)
'
@@ -92,10 +95,10 @@ test_expect_success "fetch with negative pattern refspec does not expand prefix"
(
cd three &&
alternate_in_one=$(cd ../one && git rev-parse refs/heads/alternate) &&
- master_in_one=$(cd ../one && git rev-parse refs/heads/master) &&
+ main_in_one=$(cd ../one && git rev-parse refs/heads/main) &&
echo $alternate_in_one >expect &&
- echo $master_in_one >>expect &&
- git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^master &&
+ echo $main_in_one >>expect &&
+ git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^main &&
cut -f -1 .git/FETCH_HEAD >actual &&
test_cmp expect actual
)