t551*: adjust the references 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' -- t551*.sh)

This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main`
for those tests.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Johannes Schindelin 2020-11-18 23:44:32 +00:00 committed by Junio C Hamano
parent 3275f4e886
commit bc925ce3f3
8 changed files with 441 additions and 441 deletions

View File

@ -5,7 +5,7 @@ test_description='Per branch config variables affects "git fetch".


' '


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -40,19 +40,19 @@ test_expect_success "clone and setup child repos" '
git clone . two && git clone . two &&
( (
cd 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.url ../one/.git/ &&
git config remote.one.fetch refs/heads/master:refs/heads/one git config remote.one.fetch refs/heads/main:refs/heads/one
) && ) &&
git clone . three && git clone . three &&
( (
cd three && cd three &&
git config branch.master.remote two && git config branch.main.remote two &&
git config branch.master.merge refs/heads/one && git config branch.main.merge refs/heads/one &&
mkdir -p .git/remotes && mkdir -p .git/remotes &&
{ {
echo "URL: ../two/.git/" echo "URL: ../two/.git/"
echo "Pull: refs/heads/master:refs/heads/two" echo "Pull: refs/heads/main:refs/heads/two"
echo "Pull: refs/heads/one:refs/heads/one" echo "Pull: refs/heads/one:refs/heads/one"
} >.git/remotes/two } >.git/remotes/two
) && ) &&
@ -68,7 +68,7 @@ test_expect_success "fetch test" '
git fetch && git fetch &&
git rev-parse --verify refs/heads/one && git rev-parse --verify refs/heads/one &&
mine=$(git rev-parse refs/heads/one) && mine=$(git rev-parse refs/heads/one) &&
his=$(cd ../one && git rev-parse refs/heads/master) && his=$(cd ../one && git rev-parse refs/heads/main) &&
test "z$mine" = "z$his" test "z$mine" = "z$his"
' '


@ -78,11 +78,11 @@ test_expect_success "fetch test for-merge" '
git fetch && git fetch &&
git rev-parse --verify refs/heads/two && git rev-parse --verify refs/heads/two &&
git rev-parse --verify refs/heads/one && git rev-parse --verify refs/heads/one &&
master_in_two=$(cd ../two && git rev-parse master) && main_in_two=$(cd ../two && git rev-parse main) &&
one_in_two=$(cd ../two && git rev-parse one) && one_in_two=$(cd ../two && git rev-parse one) &&
{ {
echo "$one_in_two " echo "$one_in_two "
echo "$master_in_two not-for-merge" echo "$main_in_two not-for-merge"
} >expected && } >expected &&
cut -f -2 .git/FETCH_HEAD >actual && cut -f -2 .git/FETCH_HEAD >actual &&
test_cmp expected actual' test_cmp expected actual'
@ -91,7 +91,7 @@ test_expect_success 'fetch --prune on its own works as expected' '
cd "$D" && cd "$D" &&
git clone . prune && git clone . prune &&
cd prune && cd prune &&
git update-ref refs/remotes/origin/extrabranch master && git update-ref refs/remotes/origin/extrabranch main &&


git fetch --prune origin && git fetch --prune origin &&
test_must_fail git rev-parse origin/extrabranch test_must_fail git rev-parse origin/extrabranch
@ -101,9 +101,9 @@ test_expect_success 'fetch --prune with a branch name keeps branches' '
cd "$D" && cd "$D" &&
git clone . prune-branch && git clone . prune-branch &&
cd prune-branch && cd prune-branch &&
git update-ref refs/remotes/origin/extrabranch master && git update-ref refs/remotes/origin/extrabranch main &&


git fetch --prune origin master && git fetch --prune origin main &&
git rev-parse origin/extrabranch git rev-parse origin/extrabranch
' '


@ -113,18 +113,18 @@ test_expect_success 'fetch --prune with a namespace keeps other namespaces' '
cd prune-namespace && cd prune-namespace &&


git fetch --prune origin refs/heads/a/*:refs/remotes/origin/a/* && git fetch --prune origin refs/heads/a/*:refs/remotes/origin/a/* &&
git rev-parse origin/master git rev-parse origin/main
' '


test_expect_success 'fetch --prune handles overlapping refspecs' ' test_expect_success 'fetch --prune handles overlapping refspecs' '
cd "$D" && cd "$D" &&
git update-ref refs/pull/42/head master && git update-ref refs/pull/42/head main &&
git clone . prune-overlapping && git clone . prune-overlapping &&
cd prune-overlapping && cd prune-overlapping &&
git config --add remote.origin.fetch refs/pull/*/head:refs/remotes/origin/pr/* && git config --add remote.origin.fetch refs/pull/*/head:refs/remotes/origin/pr/* &&


git fetch --prune origin && git fetch --prune origin &&
git rev-parse origin/master && git rev-parse origin/main &&
git rev-parse origin/pr/42 && git rev-parse origin/pr/42 &&


git config --unset-all remote.origin.fetch && git config --unset-all remote.origin.fetch &&
@ -132,7 +132,7 @@ test_expect_success 'fetch --prune handles overlapping refspecs' '
git config --add remote.origin.fetch refs/heads/*:refs/remotes/origin/* && git config --add remote.origin.fetch refs/heads/*:refs/remotes/origin/* &&


git fetch --prune origin && git fetch --prune origin &&
git rev-parse origin/master && git rev-parse origin/main &&
git rev-parse origin/pr/42 git rev-parse origin/pr/42
' '


@ -140,13 +140,13 @@ test_expect_success 'fetch --prune --tags prunes branches but not tags' '
cd "$D" && cd "$D" &&
git clone . prune-tags && git clone . prune-tags &&
cd prune-tags && cd prune-tags &&
git tag sometag master && git tag sometag main &&
# Create what looks like a remote-tracking branch from an earlier # Create what looks like a remote-tracking branch from an earlier
# fetch that has since been deleted from the remote: # fetch that has since been deleted from the remote:
git update-ref refs/remotes/origin/fake-remote master && git update-ref refs/remotes/origin/fake-remote main &&


git fetch --prune --tags origin && git fetch --prune --tags origin &&
git rev-parse origin/master && git rev-parse origin/main &&
test_must_fail git rev-parse origin/fake-remote && test_must_fail git rev-parse origin/fake-remote &&
git rev-parse sometag git rev-parse sometag
' '
@ -155,10 +155,10 @@ test_expect_success 'fetch --prune --tags with branch does not prune other thing
cd "$D" && cd "$D" &&
git clone . prune-tags-branch && git clone . prune-tags-branch &&
cd prune-tags-branch && cd prune-tags-branch &&
git tag sometag master && git tag sometag main &&
git update-ref refs/remotes/origin/extrabranch master && git update-ref refs/remotes/origin/extrabranch main &&


git fetch --prune --tags origin master && git fetch --prune --tags origin main &&
git rev-parse origin/extrabranch && git rev-parse origin/extrabranch &&
git rev-parse sometag git rev-parse sometag
' '
@ -167,9 +167,9 @@ test_expect_success 'fetch --prune --tags with refspec prunes based on refspec'
cd "$D" && cd "$D" &&
git clone . prune-tags-refspec && git clone . prune-tags-refspec &&
cd prune-tags-refspec && cd prune-tags-refspec &&
git tag sometag master && git tag sometag main &&
git update-ref refs/remotes/origin/foo/otherbranch master && git update-ref refs/remotes/origin/foo/otherbranch main &&
git update-ref refs/remotes/origin/extrabranch master && git update-ref refs/remotes/origin/extrabranch main &&


git fetch --prune --tags origin refs/heads/foo/*:refs/remotes/origin/foo/* && git fetch --prune --tags origin refs/heads/foo/*:refs/remotes/origin/foo/* &&
test_must_fail git rev-parse refs/remotes/origin/foo/otherbranch && test_must_fail git rev-parse refs/remotes/origin/foo/otherbranch &&
@ -180,20 +180,20 @@ test_expect_success 'fetch --prune --tags with refspec prunes based on refspec'
test_expect_success '--refmap="" ignores configured refspec' ' test_expect_success '--refmap="" ignores configured refspec' '
cd "$TRASH_DIRECTORY" && cd "$TRASH_DIRECTORY" &&
git clone "$D" remote-refs && git clone "$D" remote-refs &&
git -C remote-refs rev-parse remotes/origin/master >old && git -C remote-refs rev-parse remotes/origin/main >old &&
git -C remote-refs update-ref refs/remotes/origin/master master~1 && git -C remote-refs update-ref refs/remotes/origin/main main~1 &&
git -C remote-refs rev-parse remotes/origin/master >new && git -C remote-refs rev-parse remotes/origin/main >new &&
git -C remote-refs fetch --refmap= origin "+refs/heads/*:refs/hidden/origin/*" && git -C remote-refs fetch --refmap= origin "+refs/heads/*:refs/hidden/origin/*" &&
git -C remote-refs rev-parse remotes/origin/master >actual && git -C remote-refs rev-parse remotes/origin/main >actual &&
test_cmp new actual && test_cmp new actual &&
git -C remote-refs fetch origin && git -C remote-refs fetch origin &&
git -C remote-refs rev-parse remotes/origin/master >actual && git -C remote-refs rev-parse remotes/origin/main >actual &&
test_cmp old actual test_cmp old actual
' '


test_expect_success '--refmap="" and --prune' ' test_expect_success '--refmap="" and --prune' '
git -C remote-refs update-ref refs/remotes/origin/foo/otherbranch master && git -C remote-refs update-ref refs/remotes/origin/foo/otherbranch main &&
git -C remote-refs update-ref refs/hidden/foo/otherbranch master && git -C remote-refs update-ref refs/hidden/foo/otherbranch main &&
git -C remote-refs fetch --prune --refmap="" origin +refs/heads/*:refs/hidden/* && git -C remote-refs fetch --prune --refmap="" origin +refs/heads/*:refs/hidden/* &&
git -C remote-refs rev-parse remotes/origin/foo/otherbranch && git -C remote-refs rev-parse remotes/origin/foo/otherbranch &&
test_must_fail git -C remote-refs rev-parse refs/hidden/foo/otherbranch && test_must_fail git -C remote-refs rev-parse refs/hidden/foo/otherbranch &&
@ -253,7 +253,7 @@ test_expect_success 'fetch uses remote ref names to describe new refs' '
test_i18ngrep "new tag.* -> descriptive-tag$" actual && test_i18ngrep "new tag.* -> descriptive-tag$" actual &&
test_i18ngrep "new ref.* -> crazy$" actual test_i18ngrep "new ref.* -> crazy$" actual
) && ) &&
git checkout master git checkout main
' '


test_expect_success 'fetch must not resolve short tag name' ' test_expect_success 'fetch must not resolve short tag name' '
@ -284,7 +284,7 @@ test_expect_success 'create bundle 1' '
cd "$D" && cd "$D" &&
echo >file updated again by origin && echo >file updated again by origin &&
git commit -a -m "tip" && git commit -a -m "tip" &&
git bundle create --version=3 bundle1 master^..master git bundle create --version=3 bundle1 main^..main
' '


test_expect_success 'header of bundle looks right' ' test_expect_success 'header of bundle looks right' '
@ -292,7 +292,7 @@ test_expect_success 'header of bundle looks right' '
# v3 git bundle # v3 git bundle
@object-format=$(test_oid algo) @object-format=$(test_oid algo)
-OID updated by origin -OID updated by origin
OID refs/heads/master OID refs/heads/main


EOF EOF
sed -e "s/$OID_REGEX/OID/g" -e "5q" "$D"/bundle1 >actual && sed -e "s/$OID_REGEX/OID/g" -e "5q" "$D"/bundle1 >actual &&
@ -301,13 +301,13 @@ test_expect_success 'header of bundle looks right' '


test_expect_success 'create bundle 2' ' test_expect_success 'create bundle 2' '
cd "$D" && cd "$D" &&
git bundle create bundle2 master~2..master git bundle create bundle2 main~2..main
' '


test_expect_success 'unbundle 1' ' test_expect_success 'unbundle 1' '
cd "$D/bundle" && cd "$D/bundle" &&
git checkout -b some-branch && git checkout -b some-branch &&
test_must_fail git fetch "$D/bundle1" master:master test_must_fail git fetch "$D/bundle1" main:main
' '




@ -320,8 +320,8 @@ test_expect_success 'bundle 1 has only 3 files ' '


test_expect_success 'unbundle 2' ' test_expect_success 'unbundle 2' '
cd "$D/bundle" && cd "$D/bundle" &&
git fetch ../bundle2 master:master && git fetch ../bundle2 main:main &&
test "tip" = "$(git log -1 --pretty=oneline master | cut -d" " -f2)" test "tip" = "$(git log -1 --pretty=oneline main | cut -d" " -f2)"
' '


test_expect_success 'bundle does not prerequisite objects' ' test_expect_success 'bundle does not prerequisite objects' '
@ -338,14 +338,14 @@ test_expect_success 'bundle does not prerequisite objects' '
test_expect_success 'bundle should be able to create a full history' ' test_expect_success 'bundle should be able to create a full history' '


cd "$D" && cd "$D" &&
git tag -a -m "1.0" v1.0 master && git tag -a -m "1.0" v1.0 main &&
git bundle create bundle4 v1.0 git bundle create bundle4 v1.0


' '


test_expect_success 'fetch with a non-applying branch.<name>.merge' ' test_expect_success 'fetch with a non-applying branch.<name>.merge' '
git config branch.master.remote yeti && git config branch.main.remote yeti &&
git config branch.master.merge refs/heads/bigfoot && git config branch.main.merge refs/heads/bigfoot &&
git config remote.blub.url one && git config remote.blub.url one &&
git config remote.blub.fetch "refs/heads/*:refs/remotes/one/*" && git config remote.blub.fetch "refs/heads/*:refs/remotes/one/*" &&
git fetch blub git fetch blub
@ -365,8 +365,8 @@ test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge
# the merge spec matches the branch the remote HEAD points to # the merge spec matches the branch the remote HEAD points to
test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge [2]' ' test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge [2]' '
one_ref=$(cd one && git symbolic-ref HEAD) && one_ref=$(cd one && git symbolic-ref HEAD) &&
git config branch.master.remote blub && git config branch.main.remote blub &&
git config branch.master.merge "$one_ref" && git config branch.main.merge "$one_ref" &&
git update-ref -d FETCH_HEAD && git update-ref -d FETCH_HEAD &&
git fetch one && git fetch one &&
test $one_head = "$(git rev-parse --verify FETCH_HEAD)" && test $one_head = "$(git rev-parse --verify FETCH_HEAD)" &&
@ -376,7 +376,7 @@ test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge
# URL supplied to fetch matches the url of the configured branch's remote, but # URL supplied to fetch matches the url of the configured branch's remote, but
# the merge spec does not match the branch the remote HEAD points to # the merge spec does not match the branch the remote HEAD points to
test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge [3]' ' test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge [3]' '
git config branch.master.merge "${one_ref}_not" && git config branch.main.merge "${one_ref}_not" &&
git update-ref -d FETCH_HEAD && git update-ref -d FETCH_HEAD &&
git fetch one && git fetch one &&
test $one_head = "$(git rev-parse --verify FETCH_HEAD)" && test $one_head = "$(git rev-parse --verify FETCH_HEAD)" &&
@ -392,9 +392,9 @@ test_expect_success 'quoting of a strangely named repo' '
test_expect_success 'bundle should record HEAD correctly' ' test_expect_success 'bundle should record HEAD correctly' '


cd "$D" && cd "$D" &&
git bundle create bundle5 HEAD master && git bundle create bundle5 HEAD main &&
git bundle list-heads bundle5 >actual && git bundle list-heads bundle5 >actual &&
for h in HEAD refs/heads/master for h in HEAD refs/heads/main
do do
echo "$(git rev-parse --verify $h) $h" echo "$(git rev-parse --verify $h) $h"
done >expect && done >expect &&
@ -402,10 +402,10 @@ test_expect_success 'bundle should record HEAD correctly' '


' '


test_expect_success 'mark initial state of origin/master' ' test_expect_success 'mark initial state of origin/main' '
( (
cd three && cd three &&
git tag base-origin-master refs/remotes/origin/master git tag base-origin-main refs/remotes/origin/main
) )
' '


@ -415,10 +415,10 @@ test_expect_success 'explicit fetch should update tracking' '
git branch -f side && git branch -f side &&
( (
cd three && cd three &&
git update-ref refs/remotes/origin/master base-origin-master && git update-ref refs/remotes/origin/main base-origin-main &&
o=$(git rev-parse --verify refs/remotes/origin/master) && o=$(git rev-parse --verify refs/remotes/origin/main) &&
git fetch origin master && git fetch origin main &&
n=$(git rev-parse --verify refs/remotes/origin/master) && n=$(git rev-parse --verify refs/remotes/origin/main) &&
test "$o" != "$n" && test "$o" != "$n" &&
test_must_fail git rev-parse --verify refs/remotes/origin/side test_must_fail git rev-parse --verify refs/remotes/origin/side
) )
@ -430,10 +430,10 @@ test_expect_success 'explicit pull should update tracking' '
git branch -f side && git branch -f side &&
( (
cd three && cd three &&
git update-ref refs/remotes/origin/master base-origin-master && git update-ref refs/remotes/origin/main base-origin-main &&
o=$(git rev-parse --verify refs/remotes/origin/master) && o=$(git rev-parse --verify refs/remotes/origin/main) &&
git pull origin master && git pull origin main &&
n=$(git rev-parse --verify refs/remotes/origin/master) && n=$(git rev-parse --verify refs/remotes/origin/main) &&
test "$o" != "$n" && test "$o" != "$n" &&
test_must_fail git rev-parse --verify refs/remotes/origin/side test_must_fail git rev-parse --verify refs/remotes/origin/side
) )
@ -452,13 +452,13 @@ test_expect_success 'explicit --refmap option overrides remote.*.fetch' '
git branch -f side && git branch -f side &&
( (
cd three && cd three &&
git update-ref refs/remotes/origin/master base-origin-master && git update-ref refs/remotes/origin/main base-origin-main &&
o=$(git rev-parse --verify refs/remotes/origin/master) && o=$(git rev-parse --verify refs/remotes/origin/main) &&
git fetch --refmap="refs/heads/*:refs/remotes/other/*" origin master && git fetch --refmap="refs/heads/*:refs/remotes/other/*" origin main &&
n=$(git rev-parse --verify refs/remotes/origin/master) && n=$(git rev-parse --verify refs/remotes/origin/main) &&
test "$o" = "$n" && test "$o" = "$n" &&
test_must_fail git rev-parse --verify refs/remotes/origin/side && test_must_fail git rev-parse --verify refs/remotes/origin/side &&
git rev-parse --verify refs/remotes/other/master git rev-parse --verify refs/remotes/other/main
) )
' '


@ -467,10 +467,10 @@ test_expect_success 'explicitly empty --refmap option disables remote.*.fetch' '
git branch -f side && git branch -f side &&
( (
cd three && cd three &&
git update-ref refs/remotes/origin/master base-origin-master && git update-ref refs/remotes/origin/main base-origin-main &&
o=$(git rev-parse --verify refs/remotes/origin/master) && o=$(git rev-parse --verify refs/remotes/origin/main) &&
git fetch --refmap="" origin master && git fetch --refmap="" origin main &&
n=$(git rev-parse --verify refs/remotes/origin/master) && n=$(git rev-parse --verify refs/remotes/origin/main) &&
test "$o" = "$n" && test "$o" = "$n" &&
test_must_fail git rev-parse --verify refs/remotes/origin/side test_must_fail git rev-parse --verify refs/remotes/origin/side
) )
@ -482,10 +482,10 @@ test_expect_success 'configured fetch updates tracking' '
git branch -f side && git branch -f side &&
( (
cd three && cd three &&
git update-ref refs/remotes/origin/master base-origin-master && git update-ref refs/remotes/origin/main base-origin-main &&
o=$(git rev-parse --verify refs/remotes/origin/master) && o=$(git rev-parse --verify refs/remotes/origin/main) &&
git fetch origin && git fetch origin &&
n=$(git rev-parse --verify refs/remotes/origin/master) && n=$(git rev-parse --verify refs/remotes/origin/main) &&
test "$o" != "$n" && test "$o" != "$n" &&
git rev-parse --verify refs/remotes/origin/side git rev-parse --verify refs/remotes/origin/side
) )
@ -496,12 +496,12 @@ test_expect_success 'non-matching refspecs do not confuse tracking update' '
git update-ref refs/odd/location HEAD && git update-ref refs/odd/location HEAD &&
( (
cd three && cd three &&
git update-ref refs/remotes/origin/master base-origin-master && git update-ref refs/remotes/origin/main base-origin-main &&
git config --add remote.origin.fetch \ git config --add remote.origin.fetch \
refs/odd/location:refs/remotes/origin/odd && refs/odd/location:refs/remotes/origin/odd &&
o=$(git rev-parse --verify refs/remotes/origin/master) && o=$(git rev-parse --verify refs/remotes/origin/main) &&
git fetch origin master && git fetch origin main &&
n=$(git rev-parse --verify refs/remotes/origin/master) && n=$(git rev-parse --verify refs/remotes/origin/main) &&
test "$o" != "$n" && test "$o" != "$n" &&
test_must_fail git rev-parse --verify refs/remotes/origin/odd test_must_fail git rev-parse --verify refs/remotes/origin/odd
) )
@ -527,7 +527,7 @@ test_expect_success 'auto tag following fetches minimum' '
git tag -a -m $i excess-$i || exit 1 git tag -a -m $i excess-$i || exit 1
done done
) && ) &&
git checkout master && git checkout main &&
( (
cd follow && cd follow &&
git fetch git fetch
@ -536,13 +536,13 @@ test_expect_success 'auto tag following fetches minimum' '


test_expect_success 'refuse to fetch into the current branch' ' test_expect_success 'refuse to fetch into the current branch' '


test_must_fail git fetch . side:master test_must_fail git fetch . side:main


' '


test_expect_success 'fetch into the current branch with --update-head-ok' ' test_expect_success 'fetch into the current branch with --update-head-ok' '


git fetch --update-head-ok . side:master git fetch --update-head-ok . side:main


' '


@ -571,7 +571,7 @@ test_expect_success "should be able to fetch with duplicate refspecs" '
( (
cd dups && cd dups &&
git init && git init &&
git config branch.master.remote three && git config branch.main.remote three &&
git config remote.three.url ../three/.git && git config remote.three.url ../three/.git &&
git config remote.three.fetch +refs/heads/*:refs/remotes/origin/* && git config remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&
git config --add remote.three.fetch +refs/heads/*:refs/remotes/origin/* && git config --add remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&
@ -880,11 +880,11 @@ test_expect_success 'all boundary commits are excluded' '
test_commit oneside && test_commit oneside &&
git checkout HEAD^ && git checkout HEAD^ &&
test_commit otherside && test_commit otherside &&
git checkout master && git checkout main &&
test_tick && test_tick &&
git merge otherside && git merge otherside &&
ad=$(git log --no-walk --format=%ad HEAD) && ad=$(git log --no-walk --format=%ad HEAD) &&
git bundle create twoside-boundary.bdl master --since="$ad" && git bundle create twoside-boundary.bdl main --since="$ad" &&
convert_bundle_to_pack <twoside-boundary.bdl >twoside-boundary.pack && convert_bundle_to_pack <twoside-boundary.bdl >twoside-boundary.pack &&
pack=$(git index-pack --fix-thin --stdin <twoside-boundary.pack) && pack=$(git index-pack --fix-thin --stdin <twoside-boundary.pack) &&
test_bundle_object_count .git/objects/pack/pack-${pack##pack }.pack 3 test_bundle_object_count .git/objects/pack/pack-${pack##pack }.pack 3
@ -1020,7 +1020,7 @@ setup_negotiation_tip () {
fi && fi &&


test_commit -C "$SERVER" beta_s && test_commit -C "$SERVER" beta_s &&
git -C "$SERVER" checkout master && git -C "$SERVER" checkout main &&
test_commit -C "$SERVER" alpha_s && test_commit -C "$SERVER" alpha_s &&
git -C "$SERVER" tag -d alpha_1 alpha_2 beta_1 beta_2 git -C "$SERVER" tag -d alpha_1 alpha_2 beta_1 beta_2
} }

View File

@ -33,7 +33,7 @@ test_refspec fetch '::' invalid
test_refspec push 'refs/heads/*:refs/remotes/frotz/*' test_refspec push 'refs/heads/*:refs/remotes/frotz/*'
test_refspec push 'refs/heads/*:refs/remotes/frotz' invalid test_refspec push 'refs/heads/*:refs/remotes/frotz' invalid
test_refspec push 'refs/heads:refs/remotes/frotz/*' invalid test_refspec push 'refs/heads:refs/remotes/frotz/*' invalid
test_refspec push 'refs/heads/master:refs/remotes/frotz/xyzzy' test_refspec push 'refs/heads/main:refs/remotes/frotz/xyzzy'




# These have invalid LHS, but we do not have a formal "valid sha-1 # These have invalid LHS, but we do not have a formal "valid sha-1
@ -41,18 +41,18 @@ test_refspec push 'refs/heads/master:refs/remotes/frotz/xyzzy'
# code. They will be caught downstream anyway, but we may want to # code. They will be caught downstream anyway, but we may want to
# have tighter check later... # have tighter check later...


: test_refspec push 'refs/heads/master::refs/remotes/frotz/xyzzy' invalid : test_refspec push 'refs/heads/main::refs/remotes/frotz/xyzzy' invalid
: test_refspec push 'refs/heads/maste :refs/remotes/frotz/xyzzy' invalid : test_refspec push 'refs/heads/maste :refs/remotes/frotz/xyzzy' invalid


test_refspec fetch 'refs/heads/*:refs/remotes/frotz/*' test_refspec fetch 'refs/heads/*:refs/remotes/frotz/*'
test_refspec fetch 'refs/heads/*:refs/remotes/frotz' invalid test_refspec fetch 'refs/heads/*:refs/remotes/frotz' invalid
test_refspec fetch 'refs/heads:refs/remotes/frotz/*' invalid test_refspec fetch 'refs/heads:refs/remotes/frotz/*' invalid
test_refspec fetch 'refs/heads/master:refs/remotes/frotz/xyzzy' test_refspec fetch 'refs/heads/main:refs/remotes/frotz/xyzzy'
test_refspec fetch 'refs/heads/master::refs/remotes/frotz/xyzzy' invalid test_refspec fetch 'refs/heads/main::refs/remotes/frotz/xyzzy' invalid
test_refspec fetch 'refs/heads/maste :refs/remotes/frotz/xyzzy' invalid test_refspec fetch 'refs/heads/maste :refs/remotes/frotz/xyzzy' invalid


test_refspec push 'master~1:refs/remotes/frotz/backup' test_refspec push 'main~1:refs/remotes/frotz/backup'
test_refspec fetch 'master~1:refs/remotes/frotz/backup' invalid test_refspec fetch 'main~1:refs/remotes/frotz/backup' invalid
test_refspec push 'HEAD~4:refs/remotes/frotz/new' test_refspec push 'HEAD~4:refs/remotes/frotz/new'
test_refspec fetch 'HEAD~4:refs/remotes/frotz/new' invalid test_refspec fetch 'HEAD~4:refs/remotes/frotz/new' invalid



View File

@ -2,7 +2,7 @@


test_description='git ls-remote' test_description='git ls-remote'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -121,7 +121,7 @@ test_expect_success 'use branch.<name>.remote if possible' '
echo "From $URL" >exp_err && echo "From $URL" >exp_err &&


git remote add other $URL && git remote add other $URL &&
git config branch.master.remote other && git config branch.main.remote other &&


git ls-remote 2>actual_err >actual && git ls-remote 2>actual_err >actual &&
test_cmp exp_err actual_err && test_cmp exp_err actual_err &&
@ -132,9 +132,9 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
if test_have_prereq MINGW if test_have_prereq MINGW
then then
# Windows does not like asterisks in pathname # Windows does not like asterisks in pathname
does_not_exist=master does_not_exist=main
else else
does_not_exist="refs*master" does_not_exist="refs*main"
fi && fi &&
cat >exp <<-EOF && cat >exp <<-EOF &&
fatal: '\''$does_not_exist'\'' does not appear to be a git repository fatal: '\''$does_not_exist'\'' does not appear to be a git repository
@ -147,7 +147,7 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
# Do not expect "git ls-remote <pattern>" to work; ls-remote needs # Do not expect "git ls-remote <pattern>" to work; ls-remote needs
# <remote> if you want to feed <pattern>, just like you cannot say # <remote> if you want to feed <pattern>, just like you cannot say
# fetch <branch>. # fetch <branch>.
# We could just as easily have used "master"; the "*" emphasizes its # We could just as easily have used "main"; the "*" emphasizes its
# role as a pattern. # role as a pattern.
test_must_fail git ls-remote "$does_not_exist" >actual 2>&1 && test_must_fail git ls-remote "$does_not_exist" >actual 2>&1 &&
test_i18ncmp exp actual test_i18ncmp exp actual
@ -220,14 +220,14 @@ test_expect_success 'protocol v2 supports hiderefs' '


test_expect_success 'ls-remote --symref' ' test_expect_success 'ls-remote --symref' '
git fetch origin && git fetch origin &&
echo "ref: refs/heads/master HEAD" >expect && echo "ref: refs/heads/main HEAD" >expect &&
generate_references \ generate_references \
HEAD \ HEAD \
refs/heads/master >>expect && refs/heads/main >>expect &&
oid=$(git rev-parse HEAD) && oid=$(git rev-parse HEAD) &&
echo "$oid refs/remotes/origin/HEAD" >>expect && echo "$oid refs/remotes/origin/HEAD" >>expect &&
generate_references \ generate_references \
refs/remotes/origin/master \ refs/remotes/origin/main \
refs/tags/mark \ refs/tags/mark \
refs/tags/mark1.1 \ refs/tags/mark1.1 \
refs/tags/mark1.10 \ refs/tags/mark1.10 \
@ -241,7 +241,7 @@ test_expect_success 'ls-remote --symref' '
test_expect_success 'ls-remote with filtered symref (refname)' ' test_expect_success 'ls-remote with filtered symref (refname)' '
rev=$(git rev-parse HEAD) && rev=$(git rev-parse HEAD) &&
cat >expect <<-EOF && cat >expect <<-EOF &&
ref: refs/heads/master HEAD ref: refs/heads/main HEAD
$rev HEAD $rev HEAD
EOF EOF
# Protocol v2 supports sending symrefs for refs other than HEAD, so use # Protocol v2 supports sending symrefs for refs other than HEAD, so use
@ -255,7 +255,7 @@ test_expect_failure 'ls-remote with filtered symref (--heads)' '
cat >expect <<-EOF && cat >expect <<-EOF &&
ref: refs/tags/mark refs/heads/foo ref: refs/tags/mark refs/heads/foo
$rev refs/heads/foo $rev refs/heads/foo
$rev refs/heads/master $rev refs/heads/main
EOF EOF
# Protocol v2 supports sending symrefs for refs other than HEAD, so use # Protocol v2 supports sending symrefs for refs other than HEAD, so use
# protocol v0 here. # protocol v0 here.
@ -266,7 +266,7 @@ test_expect_failure 'ls-remote with filtered symref (--heads)' '
test_expect_success 'ls-remote --symref omits filtered-out matches' ' test_expect_success 'ls-remote --symref omits filtered-out matches' '
cat >expect <<-EOF && cat >expect <<-EOF &&
$rev refs/heads/foo $rev refs/heads/foo
$rev refs/heads/master $rev refs/heads/main
EOF EOF
# Protocol v2 supports sending symrefs for refs other than HEAD, so use # Protocol v2 supports sending symrefs for refs other than HEAD, so use
# protocol v0 here. # protocol v0 here.
@ -333,10 +333,10 @@ test_expect_success 'ls-remote --sort fails gracefully outside repository' '


test_expect_success 'ls-remote patterns work with all protocol versions' ' test_expect_success 'ls-remote patterns work with all protocol versions' '
git for-each-ref --format="%(objectname) %(refname)" \ git for-each-ref --format="%(objectname) %(refname)" \
refs/heads/master refs/remotes/origin/master >expect && refs/heads/main refs/remotes/origin/main >expect &&
git -c protocol.version=1 ls-remote . master >actual.v1 && git -c protocol.version=1 ls-remote . main >actual.v1 &&
test_cmp expect actual.v1 && test_cmp expect actual.v1 &&
git -c protocol.version=2 ls-remote . master >actual.v2 && git -c protocol.version=2 ls-remote . main >actual.v2 &&
test_cmp expect actual.v2 test_cmp expect actual.v2
' '



View File

@ -2,7 +2,7 @@


test_description='fetch --all works correctly' test_description='fetch --all works correctly'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -20,7 +20,7 @@ setup_repository () {
git add elif && git add elif &&
test_tick && test_tick &&
git commit -m "Second" && git commit -m "Second" &&
git checkout master git checkout main
) )
} }


@ -35,16 +35,16 @@ test_expect_success setup '
' '


cat > test/expect << EOF cat > test/expect << EOF
one/master one/main
one/side one/side
origin/HEAD -> origin/master origin/HEAD -> origin/main
origin/master origin/main
origin/side origin/side
three/another three/another
three/master three/main
three/side three/side
two/another two/another
two/master two/main
two/side two/side
EOF EOF


@ -73,15 +73,15 @@ test_expect_success 'git fetch --all should continue if a remote has errors' '
test_expect_success 'git fetch --all does not allow non-option arguments' ' test_expect_success 'git fetch --all does not allow non-option arguments' '
(cd test && (cd test &&
test_must_fail git fetch --all origin && test_must_fail git fetch --all origin &&
test_must_fail git fetch --all origin master) test_must_fail git fetch --all origin main)
' '


cat > expect << EOF cat > expect << EOF
origin/HEAD -> origin/master origin/HEAD -> origin/main
origin/master origin/main
origin/side origin/side
three/another three/another
three/master three/main
three/side three/side
EOF EOF


@ -95,10 +95,10 @@ test_expect_success 'git fetch --multiple (but only one remote)' '
' '


cat > expect << EOF cat > expect << EOF
one/master one/main
one/side one/side
two/another two/another
two/master two/main
two/side two/side
EOF EOF


@ -136,13 +136,13 @@ test_expect_success 'git fetch --all (skipFetchAll)' '
' '


cat > expect << EOF cat > expect << EOF
one/master one/main
one/side one/side
three/another three/another
three/master three/main
three/side three/side
two/another two/another
two/master two/main
two/side two/side
EOF EOF



File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@


test_description='pushing to a mirror repository' test_description='pushing to a mirror repository'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -18,16 +18,16 @@ invert () {
} }


mk_repo_pair () { mk_repo_pair () {
rm -rf master mirror && rm -rf main mirror &&
mkdir mirror && mkdir mirror &&
( (
cd mirror && cd mirror &&
git init && git init &&
git config receive.denyCurrentBranch warn git config receive.denyCurrentBranch warn
) && ) &&
mkdir master && mkdir main &&
( (
cd master && cd main &&
git init && git init &&
git remote add $1 up ../mirror git remote add $1 up ../mirror
) )
@ -39,13 +39,13 @@ test_expect_success 'push mirror creates new branches' '


mk_repo_pair && mk_repo_pair &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git push --mirror up git push --mirror up
) && ) &&
master_master=$(cd master && git show-ref -s --verify refs/heads/master) && main_main=$(cd main && git show-ref -s --verify refs/heads/main) &&
mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) && mirror_main=$(cd mirror && git show-ref -s --verify refs/heads/main) &&
test "$master_master" = "$mirror_master" test "$main_main" = "$mirror_main"


' '


@ -53,15 +53,15 @@ test_expect_success 'push mirror updates existing branches' '


mk_repo_pair && mk_repo_pair &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git push --mirror up && git push --mirror up &&
echo two >foo && git add foo && git commit -m two && echo two >foo && git add foo && git commit -m two &&
git push --mirror up git push --mirror up
) && ) &&
master_master=$(cd master && git show-ref -s --verify refs/heads/master) && main_main=$(cd main && git show-ref -s --verify refs/heads/main) &&
mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) && mirror_main=$(cd mirror && git show-ref -s --verify refs/heads/main) &&
test "$master_master" = "$mirror_master" test "$main_main" = "$mirror_main"


' '


@ -69,7 +69,7 @@ test_expect_success 'push mirror force updates existing branches' '


mk_repo_pair && mk_repo_pair &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git push --mirror up && git push --mirror up &&
echo two >foo && git add foo && git commit -m two && echo two >foo && git add foo && git commit -m two &&
@ -77,9 +77,9 @@ test_expect_success 'push mirror force updates existing branches' '
git reset --hard HEAD^ && git reset --hard HEAD^ &&
git push --mirror up git push --mirror up
) && ) &&
master_master=$(cd master && git show-ref -s --verify refs/heads/master) && main_main=$(cd main && git show-ref -s --verify refs/heads/main) &&
mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) && mirror_main=$(cd mirror && git show-ref -s --verify refs/heads/main) &&
test "$master_master" = "$mirror_master" test "$main_main" = "$mirror_main"


' '


@ -87,9 +87,9 @@ test_expect_success 'push mirror removes branches' '


mk_repo_pair && mk_repo_pair &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git branch remove master && git branch remove main &&
git push --mirror up && git push --mirror up &&
git branch -D remove && git branch -D remove &&
git push --mirror up git push --mirror up
@ -105,21 +105,21 @@ test_expect_success 'push mirror adds, updates and removes branches together' '


mk_repo_pair && mk_repo_pair &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git branch remove master && git branch remove main &&
git push --mirror up && git push --mirror up &&
git branch -D remove && git branch -D remove &&
git branch add master && git branch add main &&
echo two >foo && git add foo && git commit -m two && echo two >foo && git add foo && git commit -m two &&
git push --mirror up git push --mirror up
) && ) &&
master_master=$(cd master && git show-ref -s --verify refs/heads/master) && main_main=$(cd main && git show-ref -s --verify refs/heads/main) &&
master_add=$(cd master && git show-ref -s --verify refs/heads/add) && main_add=$(cd main && git show-ref -s --verify refs/heads/add) &&
mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) && mirror_main=$(cd mirror && git show-ref -s --verify refs/heads/main) &&
mirror_add=$(cd mirror && git show-ref -s --verify refs/heads/add) && mirror_add=$(cd mirror && git show-ref -s --verify refs/heads/add) &&
test "$master_master" = "$mirror_master" && test "$main_main" = "$mirror_main" &&
test "$master_add" = "$mirror_add" && test "$main_add" = "$mirror_add" &&
( (
cd mirror && cd mirror &&
invert git show-ref -s --verify refs/heads/remove invert git show-ref -s --verify refs/heads/remove
@ -133,14 +133,14 @@ test_expect_success 'push mirror creates new tags' '


mk_repo_pair && mk_repo_pair &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git tag -f tmaster master && git tag -f tmain main &&
git push --mirror up git push --mirror up
) && ) &&
master_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) && main_main=$(cd main && git show-ref -s --verify refs/tags/tmain) &&
mirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) && mirror_main=$(cd mirror && git show-ref -s --verify refs/tags/tmain) &&
test "$master_master" = "$mirror_master" test "$main_main" = "$mirror_main"


' '


@ -148,17 +148,17 @@ test_expect_success 'push mirror updates existing tags' '


mk_repo_pair && mk_repo_pair &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git tag -f tmaster master && git tag -f tmain main &&
git push --mirror up && git push --mirror up &&
echo two >foo && git add foo && git commit -m two && echo two >foo && git add foo && git commit -m two &&
git tag -f tmaster master && git tag -f tmain main &&
git push --mirror up git push --mirror up
) && ) &&
master_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) && main_main=$(cd main && git show-ref -s --verify refs/tags/tmain) &&
mirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) && mirror_main=$(cd mirror && git show-ref -s --verify refs/tags/tmain) &&
test "$master_master" = "$mirror_master" test "$main_main" = "$mirror_main"


' '


@ -166,20 +166,20 @@ test_expect_success 'push mirror force updates existing tags' '


mk_repo_pair && mk_repo_pair &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git tag -f tmaster master && git tag -f tmain main &&
git push --mirror up && git push --mirror up &&
echo two >foo && git add foo && git commit -m two && echo two >foo && git add foo && git commit -m two &&
git tag -f tmaster master && git tag -f tmain main &&
git push --mirror up && git push --mirror up &&
git reset --hard HEAD^ && git reset --hard HEAD^ &&
git tag -f tmaster master && git tag -f tmain main &&
git push --mirror up git push --mirror up
) && ) &&
master_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) && main_main=$(cd main && git show-ref -s --verify refs/tags/tmain) &&
mirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) && mirror_main=$(cd mirror && git show-ref -s --verify refs/tags/tmain) &&
test "$master_master" = "$mirror_master" test "$main_main" = "$mirror_main"


' '


@ -187,9 +187,9 @@ test_expect_success 'push mirror removes tags' '


mk_repo_pair && mk_repo_pair &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git tag -f tremove master && git tag -f tremove main &&
git push --mirror up && git push --mirror up &&
git tag -d tremove && git tag -d tremove &&
git push --mirror up git push --mirror up
@ -205,23 +205,23 @@ test_expect_success 'push mirror adds, updates and removes tags together' '


mk_repo_pair && mk_repo_pair &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git tag -f tmaster master && git tag -f tmain main &&
git tag -f tremove master && git tag -f tremove main &&
git push --mirror up && git push --mirror up &&
git tag -d tremove && git tag -d tremove &&
git tag tadd master && git tag tadd main &&
echo two >foo && git add foo && git commit -m two && echo two >foo && git add foo && git commit -m two &&
git tag -f tmaster master && git tag -f tmain main &&
git push --mirror up git push --mirror up
) && ) &&
master_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) && main_main=$(cd main && git show-ref -s --verify refs/tags/tmain) &&
master_add=$(cd master && git show-ref -s --verify refs/tags/tadd) && main_add=$(cd main && git show-ref -s --verify refs/tags/tadd) &&
mirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) && mirror_main=$(cd mirror && git show-ref -s --verify refs/tags/tmain) &&
mirror_add=$(cd mirror && git show-ref -s --verify refs/tags/tadd) && mirror_add=$(cd mirror && git show-ref -s --verify refs/tags/tadd) &&
test "$master_master" = "$mirror_master" && test "$main_main" = "$mirror_main" &&
test "$master_add" = "$mirror_add" && test "$main_add" = "$mirror_add" &&
( (
cd mirror && cd mirror &&
invert git show-ref -s --verify refs/tags/tremove invert git show-ref -s --verify refs/tags/tremove
@ -233,10 +233,10 @@ test_expect_success 'remote.foo.mirror adds and removes branches' '


mk_repo_pair --mirror && mk_repo_pair --mirror &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git branch keep master && git branch keep main &&
git branch remove master && git branch remove main &&
git push up && git push up &&
git branch -D remove && git branch -D remove &&
git push up git push up
@ -253,10 +253,10 @@ test_expect_success 'remote.foo.mirror=no has no effect' '


mk_repo_pair && mk_repo_pair &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git config --add remote.up.mirror no && git config --add remote.up.mirror no &&
git branch keep master && git branch keep main &&
git push --mirror up && git push --mirror up &&
git branch -D keep && git branch -D keep &&
git push up : git push up :
@ -271,10 +271,10 @@ test_expect_success 'remote.foo.mirror=no has no effect' '
test_expect_success 'push to mirrored repository with refspec fails' ' test_expect_success 'push to mirrored repository with refspec fails' '
mk_repo_pair && mk_repo_pair &&
( (
cd master && cd main &&
echo one >foo && git add foo && git commit -m one && echo one >foo && git add foo && git commit -m one &&
git config --add remote.up.mirror true && git config --add remote.up.mirror true &&
test_must_fail git push up master test_must_fail git push up main
) )
' '



View File

@ -5,7 +5,7 @@


test_description='fetch exit status test' test_description='fetch exit status test'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -20,20 +20,20 @@ test_expect_success setup '
echo side >file && echo side >file &&
git commit -a -m side && git commit -a -m side &&


git checkout master && git checkout main &&
echo next >file && echo next >file &&
git commit -a -m next git commit -a -m next
' '


test_expect_success 'non-fast-forward fetch' ' test_expect_success 'non-fast-forward fetch' '


test_must_fail git fetch . master:side test_must_fail git fetch . main:side


' '


test_expect_success 'forced update' ' test_expect_success 'forced update' '


git fetch . +master:side git fetch . +main:side


' '



View File

@ -2,7 +2,7 @@


test_description='push to a repository that borrows from elsewhere' test_description='push to a repository that borrows from elsewhere'


GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


. ./test-lib.sh . ./test-lib.sh
@ -20,7 +20,7 @@ test_expect_success setup '
>file && >file &&
git add . && git add . &&
git commit -m initial && git commit -m initial &&
git push ../alice-pub master git push ../alice-pub main
) && ) &&


# Project Bob is a fork of project Alice # Project Bob is a fork of project Alice
@ -34,7 +34,7 @@ test_expect_success setup '
git clone alice-pub bob-work && git clone alice-pub bob-work &&
( (
cd bob-work && cd bob-work &&
git push ../bob-pub master git push ../bob-pub main
) )
' '


@ -57,7 +57,7 @@ test_expect_success 'bob fetches from alice, works and pushes' '
# has at her public repository are available to it # has at her public repository are available to it
# via its alternates. # via its alternates.
cd bob-work && cd bob-work &&
git pull ../alice-pub master && git pull ../alice-pub main &&
echo more bob >file && echo more bob >file &&
git commit -a -m third && git commit -a -m third &&
git push ../bob-pub : git push ../bob-pub :
@ -96,7 +96,7 @@ test_expect_success 'alice works and pushes again' '
test_expect_success 'bob works and pushes' ' test_expect_success 'bob works and pushes' '
( (
# This time Bob does not pull from Alice, and # This time Bob does not pull from Alice, and
# the master branch at her public repository points # the main branch at her public repository points
# at a commit Bob does not know about. This should # at a commit Bob does not know about. This should
# not prevent the push by Bob from succeeding. # not prevent the push by Bob from succeeding.
cd bob-work && cd bob-work &&
@ -125,11 +125,11 @@ test_expect_success 'alice works and pushes yet again' '
test_expect_success 'bob works and pushes again' ' test_expect_success 'bob works and pushes again' '
( (
cd alice-pub && cd alice-pub &&
git cat-file commit master >../bob-work/commit git cat-file commit main >../bob-work/commit
) && ) &&
( (
# This time Bob does not pull from Alice, and # This time Bob does not pull from Alice, and
# the master branch at her public repository points # the main branch at her public repository points
# at a commit Bob does not fully know about, but # at a commit Bob does not fully know about, but
# he happens to have the commit object (but not the # he happens to have the commit object (but not the
# necessary tree) in his repository from Alice. # necessary tree) in his repository from Alice.