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>
Johannes Schindelin committed
Nov 18, 2020 at 23:44 UTC
bc925ce3f3c338b20b6e95b72bc40cbdc4cd3dbb
8 files changed
+441
-441
t/t5510-fetch.sh
+80
-80
@@ -5,7 +5,7 @@ test_description='Per branch config variables affects "git fetch".
5
6
'
7
8
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
8
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
9
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10
11
. ./test-lib.sh
@@ -40,19 +40,19 @@ test_expect_success "clone and setup child repos" '
40
git clone . two &&
41
(
42
cd two &&
43
- git config branch.master.remote one &&
43
+ git config branch.main.remote one &&
44
git config remote.one.url ../one/.git/ &&
45
- git config remote.one.fetch refs/heads/master:refs/heads/one
45
+ git config remote.one.fetch refs/heads/main:refs/heads/one
46
) &&
47
git clone . three &&
48
(
49
cd three &&
50
- git config branch.master.remote two &&
51
- git config branch.master.merge refs/heads/one &&
50
+ git config branch.main.remote two &&
51
+ git config branch.main.merge refs/heads/one &&
52
mkdir -p .git/remotes &&
53
{
54
echo "URL: ../two/.git/"
55
- echo "Pull: refs/heads/master:refs/heads/two"
55
+ echo "Pull: refs/heads/main:refs/heads/two"
56
echo "Pull: refs/heads/one:refs/heads/one"
57
} >.git/remotes/two
58
) &&
@@ -68,7 +68,7 @@ test_expect_success "fetch test" '
68
git fetch &&
69
git rev-parse --verify refs/heads/one &&
70
mine=$(git rev-parse refs/heads/one) &&
71
- his=$(cd ../one && git rev-parse refs/heads/master) &&
71
+ his=$(cd ../one && git rev-parse refs/heads/main) &&
72
test "z$mine" = "z$his"
73
'
74
@@ -78,11 +78,11 @@ test_expect_success "fetch test for-merge" '
78
git fetch &&
79
git rev-parse --verify refs/heads/two &&
80
git rev-parse --verify refs/heads/one &&
81
- master_in_two=$(cd ../two && git rev-parse master) &&
81
+ main_in_two=$(cd ../two && git rev-parse main) &&
82
one_in_two=$(cd ../two && git rev-parse one) &&
83
{
84
echo "$one_in_two "
85
- echo "$master_in_two not-for-merge"
85
+ echo "$main_in_two not-for-merge"
86
} >expected &&
87
cut -f -2 .git/FETCH_HEAD >actual &&
88
test_cmp expected actual'
@@ -91,7 +91,7 @@ test_expect_success 'fetch --prune on its own works as expected' '
91
cd "$D" &&
92
git clone . prune &&
93
cd prune &&
94
- git update-ref refs/remotes/origin/extrabranch master &&
94
+ git update-ref refs/remotes/origin/extrabranch main &&
95
96
git fetch --prune origin &&
97
test_must_fail git rev-parse origin/extrabranch
@@ -101,9 +101,9 @@ test_expect_success 'fetch --prune with a branch name keeps branches' '
101
cd "$D" &&
102
git clone . prune-branch &&
103
cd prune-branch &&
104
- git update-ref refs/remotes/origin/extrabranch master &&
104
+ git update-ref refs/remotes/origin/extrabranch main &&
105
106
- git fetch --prune origin master &&
106
+ git fetch --prune origin main &&
107
git rev-parse origin/extrabranch
108
'
109
@@ -113,18 +113,18 @@ test_expect_success 'fetch --prune with a namespace keeps other namespaces' '
113
cd prune-namespace &&
114
115
git fetch --prune origin refs/heads/a/*:refs/remotes/origin/a/* &&
116
- git rev-parse origin/master
116
+ git rev-parse origin/main
117
'
118
119
test_expect_success 'fetch --prune handles overlapping refspecs' '
120
cd "$D" &&
121
- git update-ref refs/pull/42/head master &&
121
+ git update-ref refs/pull/42/head main &&
122
git clone . prune-overlapping &&
123
cd prune-overlapping &&
124
git config --add remote.origin.fetch refs/pull/*/head:refs/remotes/origin/pr/* &&
125
126
git fetch --prune origin &&
127
- git rev-parse origin/master &&
127
+ git rev-parse origin/main &&
128
git rev-parse origin/pr/42 &&
129
130
git config --unset-all remote.origin.fetch &&
@@ -132,7 +132,7 @@ test_expect_success 'fetch --prune handles overlapping refspecs' '
132
git config --add remote.origin.fetch refs/heads/*:refs/remotes/origin/* &&
133
134
git fetch --prune origin &&
135
- git rev-parse origin/master &&
135
+ git rev-parse origin/main &&
136
git rev-parse origin/pr/42
137
'
138
@@ -140,13 +140,13 @@ test_expect_success 'fetch --prune --tags prunes branches but not tags' '
140
cd "$D" &&
141
git clone . prune-tags &&
142
cd prune-tags &&
143
- git tag sometag master &&
143
+ git tag sometag main &&
144
# Create what looks like a remote-tracking branch from an earlier
145
# fetch that has since been deleted from the remote:
146
- git update-ref refs/remotes/origin/fake-remote master &&
146
+ git update-ref refs/remotes/origin/fake-remote main &&
147
148
git fetch --prune --tags origin &&
149
- git rev-parse origin/master &&
149
+ git rev-parse origin/main &&
150
test_must_fail git rev-parse origin/fake-remote &&
151
git rev-parse sometag
152
'
@@ -155,10 +155,10 @@ test_expect_success 'fetch --prune --tags with branch does not prune other thing
155
cd "$D" &&
156
git clone . prune-tags-branch &&
157
cd prune-tags-branch &&
158
- git tag sometag master &&
159
- git update-ref refs/remotes/origin/extrabranch master &&
158
+ git tag sometag main &&
159
+ git update-ref refs/remotes/origin/extrabranch main &&
160
161
- git fetch --prune --tags origin master &&
161
+ git fetch --prune --tags origin main &&
162
git rev-parse origin/extrabranch &&
163
git rev-parse sometag
164
'
@@ -167,9 +167,9 @@ test_expect_success 'fetch --prune --tags with refspec prunes based on refspec'
167
cd "$D" &&
168
git clone . prune-tags-refspec &&
169
cd prune-tags-refspec &&
170
- git tag sometag master &&
171
- git update-ref refs/remotes/origin/foo/otherbranch master &&
172
- git update-ref refs/remotes/origin/extrabranch master &&
170
+ git tag sometag main &&
171
+ git update-ref refs/remotes/origin/foo/otherbranch main &&
172
+ git update-ref refs/remotes/origin/extrabranch main &&
173
174
git fetch --prune --tags origin refs/heads/foo/*:refs/remotes/origin/foo/* &&
175
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'
180
test_expect_success '--refmap="" ignores configured refspec' '
181
cd "$TRASH_DIRECTORY" &&
182
git clone "$D" remote-refs &&
183
- git -C remote-refs rev-parse remotes/origin/master >old &&
184
- git -C remote-refs update-ref refs/remotes/origin/master master~1 &&
185
- git -C remote-refs rev-parse remotes/origin/master >new &&
183
+ git -C remote-refs rev-parse remotes/origin/main >old &&
184
+ git -C remote-refs update-ref refs/remotes/origin/main main~1 &&
185
+ git -C remote-refs rev-parse remotes/origin/main >new &&
186
git -C remote-refs fetch --refmap= origin "+refs/heads/*:refs/hidden/origin/*" &&
187
- git -C remote-refs rev-parse remotes/origin/master >actual &&
187
+ git -C remote-refs rev-parse remotes/origin/main >actual &&
188
test_cmp new actual &&
189
git -C remote-refs fetch origin &&
190
- git -C remote-refs rev-parse remotes/origin/master >actual &&
190
+ git -C remote-refs rev-parse remotes/origin/main >actual &&
191
test_cmp old actual
192
'
193
194
test_expect_success '--refmap="" and --prune' '
195
- git -C remote-refs update-ref refs/remotes/origin/foo/otherbranch master &&
196
- git -C remote-refs update-ref refs/hidden/foo/otherbranch master &&
195
+ git -C remote-refs update-ref refs/remotes/origin/foo/otherbranch main &&
196
+ git -C remote-refs update-ref refs/hidden/foo/otherbranch main &&
197
git -C remote-refs fetch --prune --refmap="" origin +refs/heads/*:refs/hidden/* &&
198
git -C remote-refs rev-parse remotes/origin/foo/otherbranch &&
199
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' '
253
test_i18ngrep "new tag.* -> descriptive-tag$" actual &&
254
test_i18ngrep "new ref.* -> crazy$" actual
255
) &&
256
- git checkout master
256
+ git checkout main
257
'
258
259
test_expect_success 'fetch must not resolve short tag name' '
@@ -284,7 +284,7 @@ test_expect_success 'create bundle 1' '
284
cd "$D" &&
285
echo >file updated again by origin &&
286
git commit -a -m "tip" &&
287
- git bundle create --version=3 bundle1 master^..master
287
+ git bundle create --version=3 bundle1 main^..main
288
'
289
290
test_expect_success 'header of bundle looks right' '
@@ -292,7 +292,7 @@ test_expect_success 'header of bundle looks right' '
292
# v3 git bundle
293
@object-format=$(test_oid algo)
294
-OID updated by origin
295
- OID refs/heads/master
295
+ OID refs/heads/main
296
297
EOF
298
sed -e "s/$OID_REGEX/OID/g" -e "5q" "$D"/bundle1 >actual &&
@@ -301,13 +301,13 @@ test_expect_success 'header of bundle looks right' '
301
302
test_expect_success 'create bundle 2' '
303
cd "$D" &&
304
- git bundle create bundle2 master~2..master
304
+ git bundle create bundle2 main~2..main
305
'
306
307
test_expect_success 'unbundle 1' '
308
cd "$D/bundle" &&
309
git checkout -b some-branch &&
310
- test_must_fail git fetch "$D/bundle1" master:master
310
+ test_must_fail git fetch "$D/bundle1" main:main
311
'
312
313
@@ -320,8 +320,8 @@ test_expect_success 'bundle 1 has only 3 files ' '
320
321
test_expect_success 'unbundle 2' '
322
cd "$D/bundle" &&
323
- git fetch ../bundle2 master:master &&
324
- test "tip" = "$(git log -1 --pretty=oneline master | cut -d" " -f2)"
323
+ git fetch ../bundle2 main:main &&
324
+ test "tip" = "$(git log -1 --pretty=oneline main | cut -d" " -f2)"
325
'
326
327
test_expect_success 'bundle does not prerequisite objects' '
@@ -338,14 +338,14 @@ test_expect_success 'bundle does not prerequisite objects' '
338
test_expect_success 'bundle should be able to create a full history' '
339
340
cd "$D" &&
341
- git tag -a -m "1.0" v1.0 master &&
341
+ git tag -a -m "1.0" v1.0 main &&
342
git bundle create bundle4 v1.0
343
344
'
345
346
test_expect_success 'fetch with a non-applying branch.<name>.merge' '
347
- git config branch.master.remote yeti &&
348
- git config branch.master.merge refs/heads/bigfoot &&
347
+ git config branch.main.remote yeti &&
348
+ git config branch.main.merge refs/heads/bigfoot &&
349
git config remote.blub.url one &&
350
git config remote.blub.fetch "refs/heads/*:refs/remotes/one/*" &&
351
git fetch blub
@@ -365,8 +365,8 @@ test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge
365
# the merge spec matches the branch the remote HEAD points to
366
test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge [2]' '
367
one_ref=$(cd one && git symbolic-ref HEAD) &&
368
- git config branch.master.remote blub &&
369
- git config branch.master.merge "$one_ref" &&
368
+ git config branch.main.remote blub &&
369
+ git config branch.main.merge "$one_ref" &&
370
git update-ref -d FETCH_HEAD &&
371
git fetch one &&
372
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
376
# URL supplied to fetch matches the url of the configured branch's remote, but
377
# the merge spec does not match the branch the remote HEAD points to
378
test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge [3]' '
379
- git config branch.master.merge "${one_ref}_not" &&
379
+ git config branch.main.merge "${one_ref}_not" &&
380
git update-ref -d FETCH_HEAD &&
381
git fetch one &&
382
test $one_head = "$(git rev-parse --verify FETCH_HEAD)" &&
@@ -392,9 +392,9 @@ test_expect_success 'quoting of a strangely named repo' '
392
test_expect_success 'bundle should record HEAD correctly' '
393
394
cd "$D" &&
395
- git bundle create bundle5 HEAD master &&
395
+ git bundle create bundle5 HEAD main &&
396
git bundle list-heads bundle5 >actual &&
397
- for h in HEAD refs/heads/master
397
+ for h in HEAD refs/heads/main
398
do
399
echo "$(git rev-parse --verify $h) $h"
400
done >expect &&
@@ -402,10 +402,10 @@ test_expect_success 'bundle should record HEAD correctly' '
402
403
'
404
405
-test_expect_success 'mark initial state of origin/master' '
405
+test_expect_success 'mark initial state of origin/main' '
406
(
407
cd three &&
408
- git tag base-origin-master refs/remotes/origin/master
408
+ git tag base-origin-main refs/remotes/origin/main
409
)
410
'
411
@@ -415,10 +415,10 @@ test_expect_success 'explicit fetch should update tracking' '
415
git branch -f side &&
416
(
417
cd three &&
418
- git update-ref refs/remotes/origin/master base-origin-master &&
419
- o=$(git rev-parse --verify refs/remotes/origin/master) &&
420
- git fetch origin master &&
421
- n=$(git rev-parse --verify refs/remotes/origin/master) &&
418
+ git update-ref refs/remotes/origin/main base-origin-main &&
419
+ o=$(git rev-parse --verify refs/remotes/origin/main) &&
420
+ git fetch origin main &&
421
+ n=$(git rev-parse --verify refs/remotes/origin/main) &&
422
test "$o" != "$n" &&
423
test_must_fail git rev-parse --verify refs/remotes/origin/side
424
)
@@ -430,10 +430,10 @@ test_expect_success 'explicit pull should update tracking' '
430
git branch -f side &&
431
(
432
cd three &&
433
- git update-ref refs/remotes/origin/master base-origin-master &&
434
- o=$(git rev-parse --verify refs/remotes/origin/master) &&
435
- git pull origin master &&
436
- n=$(git rev-parse --verify refs/remotes/origin/master) &&
433
+ git update-ref refs/remotes/origin/main base-origin-main &&
434
+ o=$(git rev-parse --verify refs/remotes/origin/main) &&
435
+ git pull origin main &&
436
+ n=$(git rev-parse --verify refs/remotes/origin/main) &&
437
test "$o" != "$n" &&
438
test_must_fail git rev-parse --verify refs/remotes/origin/side
439
)
@@ -452,13 +452,13 @@ test_expect_success 'explicit --refmap option overrides remote.*.fetch' '
452
git branch -f side &&
453
(
454
cd three &&
455
- git update-ref refs/remotes/origin/master base-origin-master &&
456
- o=$(git rev-parse --verify refs/remotes/origin/master) &&
457
- git fetch --refmap="refs/heads/*:refs/remotes/other/*" origin master &&
458
- n=$(git rev-parse --verify refs/remotes/origin/master) &&
455
+ git update-ref refs/remotes/origin/main base-origin-main &&
456
+ o=$(git rev-parse --verify refs/remotes/origin/main) &&
457
+ git fetch --refmap="refs/heads/*:refs/remotes/other/*" origin main &&
458
+ n=$(git rev-parse --verify refs/remotes/origin/main) &&
459
test "$o" = "$n" &&
460
test_must_fail git rev-parse --verify refs/remotes/origin/side &&
461
- git rev-parse --verify refs/remotes/other/master
461
+ git rev-parse --verify refs/remotes/other/main
462
)
463
'
464
@@ -467,10 +467,10 @@ test_expect_success 'explicitly empty --refmap option disables remote.*.fetch' '
467
git branch -f side &&
468
(
469
cd three &&
470
- git update-ref refs/remotes/origin/master base-origin-master &&
471
- o=$(git rev-parse --verify refs/remotes/origin/master) &&
472
- git fetch --refmap="" origin master &&
473
- n=$(git rev-parse --verify refs/remotes/origin/master) &&
470
+ git update-ref refs/remotes/origin/main base-origin-main &&
471
+ o=$(git rev-parse --verify refs/remotes/origin/main) &&
472
+ git fetch --refmap="" origin main &&
473
+ n=$(git rev-parse --verify refs/remotes/origin/main) &&
474
test "$o" = "$n" &&
475
test_must_fail git rev-parse --verify refs/remotes/origin/side
476
)
@@ -482,10 +482,10 @@ test_expect_success 'configured fetch updates tracking' '
482
git branch -f side &&
483
(
484
cd three &&
485
- git update-ref refs/remotes/origin/master base-origin-master &&
486
- o=$(git rev-parse --verify refs/remotes/origin/master) &&
485
+ git update-ref refs/remotes/origin/main base-origin-main &&
486
+ o=$(git rev-parse --verify refs/remotes/origin/main) &&
487
git fetch origin &&
488
- n=$(git rev-parse --verify refs/remotes/origin/master) &&
488
+ n=$(git rev-parse --verify refs/remotes/origin/main) &&
489
test "$o" != "$n" &&
490
git rev-parse --verify refs/remotes/origin/side
491
)
@@ -496,12 +496,12 @@ test_expect_success 'non-matching refspecs do not confuse tracking update' '
496
git update-ref refs/odd/location HEAD &&
497
(
498
cd three &&
499
- git update-ref refs/remotes/origin/master base-origin-master &&
499
+ git update-ref refs/remotes/origin/main base-origin-main &&
500
git config --add remote.origin.fetch \
501
refs/odd/location:refs/remotes/origin/odd &&
502
- o=$(git rev-parse --verify refs/remotes/origin/master) &&
503
- git fetch origin master &&
504
- n=$(git rev-parse --verify refs/remotes/origin/master) &&
502
+ o=$(git rev-parse --verify refs/remotes/origin/main) &&
503
+ git fetch origin main &&
504
+ n=$(git rev-parse --verify refs/remotes/origin/main) &&
505
test "$o" != "$n" &&
506
test_must_fail git rev-parse --verify refs/remotes/origin/odd
507
)
@@ -527,7 +527,7 @@ test_expect_success 'auto tag following fetches minimum' '
527
git tag -a -m $i excess-$i || exit 1
528
done
529
) &&
530
- git checkout master &&
530
+ git checkout main &&
531
(
532
cd follow &&
533
git fetch
@@ -536,13 +536,13 @@ test_expect_success 'auto tag following fetches minimum' '
536
537
test_expect_success 'refuse to fetch into the current branch' '
538
539
- test_must_fail git fetch . side:master
539
+ test_must_fail git fetch . side:main
540
541
'
542
543
test_expect_success 'fetch into the current branch with --update-head-ok' '
544
545
- git fetch --update-head-ok . side:master
545
+ git fetch --update-head-ok . side:main
546
547
'
548
@@ -571,7 +571,7 @@ test_expect_success "should be able to fetch with duplicate refspecs" '
571
(
572
cd dups &&
573
git init &&
574
- git config branch.master.remote three &&
574
+ git config branch.main.remote three &&
575
git config remote.three.url ../three/.git &&
576
git config remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&
577
git config --add remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&
@@ -880,11 +880,11 @@ test_expect_success 'all boundary commits are excluded' '
880
test_commit oneside &&
881
git checkout HEAD^ &&
882
test_commit otherside &&
883
- git checkout master &&
883
+ git checkout main &&
884
test_tick &&
885
git merge otherside &&
886
ad=$(git log --no-walk --format=%ad HEAD) &&
887
- git bundle create twoside-boundary.bdl master --since="$ad" &&
887
+ git bundle create twoside-boundary.bdl main --since="$ad" &&
888
convert_bundle_to_pack <twoside-boundary.bdl >twoside-boundary.pack &&
889
pack=$(git index-pack --fix-thin --stdin <twoside-boundary.pack) &&
890
test_bundle_object_count .git/objects/pack/pack-${pack##pack }.pack 3
@@ -1020,7 +1020,7 @@ setup_negotiation_tip () {
1020
fi &&
1021
1022
test_commit -C "$SERVER" beta_s &&
1023
- git -C "$SERVER" checkout master &&
1023
+ git -C "$SERVER" checkout main &&
1024
test_commit -C "$SERVER" alpha_s &&
1025
git -C "$SERVER" tag -d alpha_1 alpha_2 beta_1 beta_2
1026
}
t/t5511-refspec.sh
+6
-6
@@ -33,7 +33,7 @@ test_refspec fetch '::' invalid
33
test_refspec push 'refs/heads/*:refs/remotes/frotz/*'
34
test_refspec push 'refs/heads/*:refs/remotes/frotz' invalid
35
test_refspec push 'refs/heads:refs/remotes/frotz/*' invalid
36
-test_refspec push 'refs/heads/master:refs/remotes/frotz/xyzzy'
36
+test_refspec push 'refs/heads/main:refs/remotes/frotz/xyzzy'
37
38
39
# 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'
41
# code. They will be caught downstream anyway, but we may want to
42
# have tighter check later...
43
44
-: test_refspec push 'refs/heads/master::refs/remotes/frotz/xyzzy' invalid
44
+: test_refspec push 'refs/heads/main::refs/remotes/frotz/xyzzy' invalid
45
: test_refspec push 'refs/heads/maste :refs/remotes/frotz/xyzzy' invalid
46
47
test_refspec fetch 'refs/heads/*:refs/remotes/frotz/*'
48
test_refspec fetch 'refs/heads/*:refs/remotes/frotz' invalid
49
test_refspec fetch 'refs/heads:refs/remotes/frotz/*' invalid
50
-test_refspec fetch 'refs/heads/master:refs/remotes/frotz/xyzzy'
51
-test_refspec fetch 'refs/heads/master::refs/remotes/frotz/xyzzy' invalid
50
+test_refspec fetch 'refs/heads/main:refs/remotes/frotz/xyzzy'
51
+test_refspec fetch 'refs/heads/main::refs/remotes/frotz/xyzzy' invalid
52
test_refspec fetch 'refs/heads/maste :refs/remotes/frotz/xyzzy' invalid
53
54
-test_refspec push 'master~1:refs/remotes/frotz/backup'
55
-test_refspec fetch 'master~1:refs/remotes/frotz/backup' invalid
54
+test_refspec push 'main~1:refs/remotes/frotz/backup'
55
+test_refspec fetch 'main~1:refs/remotes/frotz/backup' invalid
56
test_refspec push 'HEAD~4:refs/remotes/frotz/new'
57
test_refspec fetch 'HEAD~4:refs/remotes/frotz/new' invalid
58
t/t5512-ls-remote.sh
+14
-14
@@ -2,7 +2,7 @@
2
3
test_description='git ls-remote'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -121,7 +121,7 @@ test_expect_success 'use branch.<name>.remote if possible' '
121
echo "From $URL" >exp_err &&
122
123
git remote add other $URL &&
124
- git config branch.master.remote other &&
124
+ git config branch.main.remote other &&
125
126
git ls-remote 2>actual_err >actual &&
127
test_cmp exp_err actual_err &&
@@ -132,9 +132,9 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
132
if test_have_prereq MINGW
133
then
134
# Windows does not like asterisks in pathname
135
- does_not_exist=master
135
+ does_not_exist=main
136
else
137
- does_not_exist="refs*master"
137
+ does_not_exist="refs*main"
138
fi &&
139
cat >exp <<-EOF &&
140
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' '
147
# Do not expect "git ls-remote <pattern>" to work; ls-remote needs
148
# <remote> if you want to feed <pattern>, just like you cannot say
149
# fetch <branch>.
150
- # We could just as easily have used "master"; the "*" emphasizes its
150
+ # We could just as easily have used "main"; the "*" emphasizes its
151
# role as a pattern.
152
test_must_fail git ls-remote "$does_not_exist" >actual 2>&1 &&
153
test_i18ncmp exp actual
@@ -220,14 +220,14 @@ test_expect_success 'protocol v2 supports hiderefs' '
220
221
test_expect_success 'ls-remote --symref' '
222
git fetch origin &&
223
- echo "ref: refs/heads/master HEAD" >expect &&
223
+ echo "ref: refs/heads/main HEAD" >expect &&
224
generate_references \
225
HEAD \
226
- refs/heads/master >>expect &&
226
+ refs/heads/main >>expect &&
227
oid=$(git rev-parse HEAD) &&
228
echo "$oid refs/remotes/origin/HEAD" >>expect &&
229
generate_references \
230
- refs/remotes/origin/master \
230
+ refs/remotes/origin/main \
231
refs/tags/mark \
232
refs/tags/mark1.1 \
233
refs/tags/mark1.10 \
@@ -241,7 +241,7 @@ test_expect_success 'ls-remote --symref' '
241
test_expect_success 'ls-remote with filtered symref (refname)' '
242
rev=$(git rev-parse HEAD) &&
243
cat >expect <<-EOF &&
244
- ref: refs/heads/master HEAD
244
+ ref: refs/heads/main HEAD
245
$rev HEAD
246
EOF
247
# 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)' '
255
cat >expect <<-EOF &&
256
ref: refs/tags/mark refs/heads/foo
257
$rev refs/heads/foo
258
- $rev refs/heads/master
258
+ $rev refs/heads/main
259
EOF
260
# Protocol v2 supports sending symrefs for refs other than HEAD, so use
261
# protocol v0 here.
@@ -266,7 +266,7 @@ test_expect_failure 'ls-remote with filtered symref (--heads)' '
266
test_expect_success 'ls-remote --symref omits filtered-out matches' '
267
cat >expect <<-EOF &&
268
$rev refs/heads/foo
269
- $rev refs/heads/master
269
+ $rev refs/heads/main
270
EOF
271
# Protocol v2 supports sending symrefs for refs other than HEAD, so use
272
# protocol v0 here.
@@ -333,10 +333,10 @@ test_expect_success 'ls-remote --sort fails gracefully outside repository' '
333
334
test_expect_success 'ls-remote patterns work with all protocol versions' '
335
git for-each-ref --format="%(objectname) %(refname)" \
336
- refs/heads/master refs/remotes/origin/master >expect &&
337
- git -c protocol.version=1 ls-remote . master >actual.v1 &&
336
+ refs/heads/main refs/remotes/origin/main >expect &&
337
+ git -c protocol.version=1 ls-remote . main >actual.v1 &&
338
test_cmp expect actual.v1 &&
339
- git -c protocol.version=2 ls-remote . master >actual.v2 &&
339
+ git -c protocol.version=2 ls-remote . main >actual.v2 &&
340
test_cmp expect actual.v2
341
'
342
t/t5514-fetch-multiple.sh
+16
-16
@@ -2,7 +2,7 @@
2
3
test_description='fetch --all works correctly'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -20,7 +20,7 @@ setup_repository () {
20
git add elif &&
21
test_tick &&
22
git commit -m "Second" &&
23
- git checkout master
23
+ git checkout main
24
)
25
}
26
@@ -35,16 +35,16 @@ test_expect_success setup '
35
'
36
37
cat > test/expect << EOF
38
- one/master
38
+ one/main
39
one/side
40
- origin/HEAD -> origin/master
41
- origin/master
40
+ origin/HEAD -> origin/main
41
+ origin/main
42
origin/side
43
three/another
44
- three/master
44
+ three/main
45
three/side
46
two/another
47
- two/master
47
+ two/main
48
two/side
49
EOF
50
@@ -73,15 +73,15 @@ test_expect_success 'git fetch --all should continue if a remote has errors' '
73
test_expect_success 'git fetch --all does not allow non-option arguments' '
74
(cd test &&
75
test_must_fail git fetch --all origin &&
76
- test_must_fail git fetch --all origin master)
76
+ test_must_fail git fetch --all origin main)
77
'
78
79
cat > expect << EOF
80
- origin/HEAD -> origin/master
81
- origin/master
80
+ origin/HEAD -> origin/main
81
+ origin/main
82
origin/side
83
three/another
84
- three/master
84
+ three/main
85
three/side
86
EOF
87
@@ -95,10 +95,10 @@ test_expect_success 'git fetch --multiple (but only one remote)' '
95
'
96
97
cat > expect << EOF
98
- one/master
98
+ one/main
99
one/side
100
two/another
101
- two/master
101
+ two/main
102
two/side
103
EOF
104
@@ -136,13 +136,13 @@ test_expect_success 'git fetch --all (skipFetchAll)' '
136
'
137
138
cat > expect << EOF
139
- one/master
139
+ one/main
140
one/side
141
three/another
142
- three/master
142
+ three/main
143
three/side
144
two/another
145
- two/master
145
+ two/main
146
two/side
147
EOF
148
t/t5516-fetch-push.sh
+251
-251
@@ -14,7 +14,7 @@ This test checks the following functionality:
14
* reflogs
15
'
16
17
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
17
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
18
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
19
20
. ./test-lib.sh
@@ -123,13 +123,13 @@ test_expect_success setup '
123
git add path1 &&
124
test_tick &&
125
git commit -a -m repo &&
126
- the_first_commit=$(git show-ref -s --verify refs/heads/master) &&
126
+ the_first_commit=$(git show-ref -s --verify refs/heads/main) &&
127
128
>path2 &&
129
git add path2 &&
130
test_tick &&
131
git commit -a -m second &&
132
- the_commit=$(git show-ref -s --verify refs/heads/master)
132
+ the_commit=$(git show-ref -s --verify refs/heads/main)
133
134
'
135
@@ -137,9 +137,9 @@ test_expect_success 'fetch without wildcard' '
137
mk_empty testrepo &&
138
(
139
cd testrepo &&
140
- git fetch .. refs/heads/master:refs/remotes/origin/master &&
140
+ git fetch .. refs/heads/main:refs/remotes/origin/main &&
141
142
- echo "$the_commit commit refs/remotes/origin/master" >expect &&
142
+ echo "$the_commit commit refs/remotes/origin/main" >expect &&
143
git for-each-ref refs/remotes/origin >actual &&
144
test_cmp expect actual
145
)
@@ -153,7 +153,7 @@ test_expect_success 'fetch with wildcard' '
153
git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
154
git fetch up &&
155
156
- echo "$the_commit commit refs/remotes/origin/master" >expect &&
156
+ echo "$the_commit commit refs/remotes/origin/main" >expect &&
157
git for-each-ref refs/remotes/origin >actual &&
158
test_cmp expect actual
159
)
@@ -169,7 +169,7 @@ test_expect_success 'fetch with insteadOf' '
169
git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
170
git fetch up &&
171
172
- echo "$the_commit commit refs/remotes/origin/master" >expect &&
172
+ echo "$the_commit commit refs/remotes/origin/main" >expect &&
173
git for-each-ref refs/remotes/origin >actual &&
174
test_cmp expect actual
175
)
@@ -185,7 +185,7 @@ test_expect_success 'fetch with pushInsteadOf (should not rewrite)' '
185
git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
186
git fetch up &&
187
188
- echo "$the_commit commit refs/remotes/origin/master" >expect &&
188
+ echo "$the_commit commit refs/remotes/origin/main" >expect &&
189
git for-each-ref refs/remotes/origin >actual &&
190
test_cmp expect actual
191
)
@@ -194,10 +194,10 @@ test_expect_success 'fetch with pushInsteadOf (should not rewrite)' '
194
test_expect_success 'push without wildcard' '
195
mk_empty testrepo &&
196
197
- git push testrepo refs/heads/master:refs/remotes/origin/master &&
197
+ git push testrepo refs/heads/main:refs/remotes/origin/main &&
198
(
199
cd testrepo &&
200
- echo "$the_commit commit refs/remotes/origin/master" >expect &&
200
+ echo "$the_commit commit refs/remotes/origin/main" >expect &&
201
git for-each-ref refs/remotes/origin >actual &&
202
test_cmp expect actual
203
)
@@ -209,7 +209,7 @@ test_expect_success 'push with wildcard' '
209
git push testrepo "refs/heads/*:refs/remotes/origin/*" &&
210
(
211
cd testrepo &&
212
- echo "$the_commit commit refs/remotes/origin/master" >expect &&
212
+ echo "$the_commit commit refs/remotes/origin/main" >expect &&
213
git for-each-ref refs/remotes/origin >actual &&
214
test_cmp expect actual
215
)
@@ -219,10 +219,10 @@ test_expect_success 'push with insteadOf' '
219
mk_empty testrepo &&
220
TRASH="$(pwd)/" &&
221
test_config "url.$TRASH.insteadOf" trash/ &&
222
- git push trash/testrepo refs/heads/master:refs/remotes/origin/master &&
222
+ git push trash/testrepo refs/heads/main:refs/remotes/origin/main &&
223
(
224
cd testrepo &&
225
- echo "$the_commit commit refs/remotes/origin/master" >expect &&
225
+ echo "$the_commit commit refs/remotes/origin/main" >expect &&
226
git for-each-ref refs/remotes/origin >actual &&
227
test_cmp expect actual
228
)
@@ -232,10 +232,10 @@ test_expect_success 'push with pushInsteadOf' '
232
mk_empty testrepo &&
233
TRASH="$(pwd)/" &&
234
test_config "url.$TRASH.pushInsteadOf" trash/ &&
235
- git push trash/testrepo refs/heads/master:refs/remotes/origin/master &&
235
+ git push trash/testrepo refs/heads/main:refs/remotes/origin/main &&
236
(
237
cd testrepo &&
238
- echo "$the_commit commit refs/remotes/origin/master" >expect &&
238
+ echo "$the_commit commit refs/remotes/origin/main" >expect &&
239
git for-each-ref refs/remotes/origin >actual &&
240
test_cmp expect actual
241
)
@@ -247,10 +247,10 @@ test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf
247
test_config "url.trash3/.pushInsteadOf" trash/wrong &&
248
test_config remote.r.url trash/wrong &&
249
test_config remote.r.pushurl "testrepo/" &&
250
- git push r refs/heads/master:refs/remotes/origin/master &&
250
+ git push r refs/heads/main:refs/remotes/origin/main &&
251
(
252
cd testrepo &&
253
- echo "$the_commit commit refs/remotes/origin/master" >expect &&
253
+ echo "$the_commit commit refs/remotes/origin/main" >expect &&
254
git for-each-ref refs/remotes/origin >actual &&
255
test_cmp expect actual
256
)
@@ -258,101 +258,101 @@ test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf
258
259
test_expect_success 'push with matching heads' '
260
261
- mk_test testrepo heads/master &&
261
+ mk_test testrepo heads/main &&
262
git push testrepo : &&
263
- check_push_result testrepo $the_commit heads/master
263
+ check_push_result testrepo $the_commit heads/main
264
265
'
266
267
test_expect_success 'push with matching heads on the command line' '
268
269
- mk_test testrepo heads/master &&
269
+ mk_test testrepo heads/main &&
270
git push testrepo : &&
271
- check_push_result testrepo $the_commit heads/master
271
+ check_push_result testrepo $the_commit heads/main
272
273
'
274
275
test_expect_success 'failed (non-fast-forward) push with matching heads' '
276
277
- mk_test testrepo heads/master &&
277
+ mk_test testrepo heads/main &&
278
git push testrepo : &&
279
git commit --amend -massaged &&
280
test_must_fail git push testrepo &&
281
- check_push_result testrepo $the_commit heads/master &&
281
+ check_push_result testrepo $the_commit heads/main &&
282
git reset --hard $the_commit
283
284
'
285
286
test_expect_success 'push --force with matching heads' '
287
288
- mk_test testrepo heads/master &&
288
+ mk_test testrepo heads/main &&
289
git push testrepo : &&
290
git commit --amend -massaged &&
291
git push --force testrepo : &&
292
- ! check_push_result testrepo $the_commit heads/master &&
292
+ ! check_push_result testrepo $the_commit heads/main &&
293
git reset --hard $the_commit
294
295
'
296
297
test_expect_success 'push with matching heads and forced update' '
298
299
- mk_test testrepo heads/master &&
299
+ mk_test testrepo heads/main &&
300
git push testrepo : &&
301
git commit --amend -massaged &&
302
git push testrepo +: &&
303
- ! check_push_result testrepo $the_commit heads/master &&
303
+ ! check_push_result testrepo $the_commit heads/main &&
304
git reset --hard $the_commit
305
306
'
307
308
test_expect_success 'push with no ambiguity (1)' '
309
310
- mk_test testrepo heads/master &&
311
- git push testrepo master:master &&
312
- check_push_result testrepo $the_commit heads/master
310
+ mk_test testrepo heads/main &&
311
+ git push testrepo main:main &&
312
+ check_push_result testrepo $the_commit heads/main
313
314
'
315
316
test_expect_success 'push with no ambiguity (2)' '
317
318
- mk_test testrepo remotes/origin/master &&
319
- git push testrepo master:origin/master &&
320
- check_push_result testrepo $the_commit remotes/origin/master
318
+ mk_test testrepo remotes/origin/main &&
319
+ git push testrepo main:origin/main &&
320
+ check_push_result testrepo $the_commit remotes/origin/main
321
322
'
323
324
test_expect_success 'push with colon-less refspec, no ambiguity' '
325
326
- mk_test testrepo heads/master heads/t/master &&
327
- git branch -f t/master master &&
328
- git push testrepo master &&
329
- check_push_result testrepo $the_commit heads/master &&
330
- check_push_result testrepo $the_first_commit heads/t/master
326
+ mk_test testrepo heads/main heads/t/main &&
327
+ git branch -f t/main main &&
328
+ git push testrepo main &&
329
+ check_push_result testrepo $the_commit heads/main &&
330
+ check_push_result testrepo $the_first_commit heads/t/main
331
332
'
333
334
test_expect_success 'push with weak ambiguity (1)' '
335
336
- mk_test testrepo heads/master remotes/origin/master &&
337
- git push testrepo master:master &&
338
- check_push_result testrepo $the_commit heads/master &&
339
- check_push_result testrepo $the_first_commit remotes/origin/master
336
+ mk_test testrepo heads/main remotes/origin/main &&
337
+ git push testrepo main:main &&
338
+ check_push_result testrepo $the_commit heads/main &&
339
+ check_push_result testrepo $the_first_commit remotes/origin/main
340
341
'
342
343
test_expect_success 'push with weak ambiguity (2)' '
344
345
- mk_test testrepo heads/master remotes/origin/master remotes/another/master &&
346
- git push testrepo master:master &&
347
- check_push_result testrepo $the_commit heads/master &&
348
- check_push_result testrepo $the_first_commit remotes/origin/master remotes/another/master
345
+ mk_test testrepo heads/main remotes/origin/main remotes/another/main &&
346
+ git push testrepo main:main &&
347
+ check_push_result testrepo $the_commit heads/main &&
348
+ check_push_result testrepo $the_first_commit remotes/origin/main remotes/another/main
349
350
'
351
352
test_expect_success 'push with ambiguity' '
353
354
mk_test testrepo heads/frotz tags/frotz &&
355
- test_must_fail git push testrepo master:frotz &&
355
+ test_must_fail git push testrepo main:frotz &&
356
check_push_result testrepo $the_first_commit heads/frotz tags/frotz
357
358
'
@@ -360,7 +360,7 @@ test_expect_success 'push with ambiguity' '
360
test_expect_success 'push with colon-less refspec (1)' '
361
362
mk_test testrepo heads/frotz tags/frotz &&
363
- git branch -f frotz master &&
363
+ git branch -f frotz main &&
364
git push testrepo frotz &&
365
check_push_result testrepo $the_commit heads/frotz &&
366
check_push_result testrepo $the_first_commit tags/frotz
@@ -388,7 +388,7 @@ test_expect_success 'push with colon-less refspec (3)' '
388
then
389
git tag -d frotz
390
fi &&
391
- git branch -f frotz master &&
391
+ git branch -f frotz main &&
392
git push testrepo frotz &&
393
check_push_result testrepo $the_commit heads/frotz &&
394
test 1 = $( cd testrepo && git show-ref | wc -l )
@@ -411,7 +411,7 @@ test_expect_success 'push with colon-less refspec (4)' '
411
test_expect_success 'push head with non-existent, incomplete dest' '
412
413
mk_test testrepo &&
414
- git push testrepo master:branch &&
414
+ git push testrepo main:branch &&
415
check_push_result testrepo $the_commit heads/branch
416
417
'
@@ -428,42 +428,42 @@ test_expect_success 'push tag with non-existent, incomplete dest' '
428
test_expect_success 'push sha1 with non-existent, incomplete dest' '
429
430
mk_test testrepo &&
431
- test_must_fail git push testrepo $(git rev-parse master):foo
431
+ test_must_fail git push testrepo $(git rev-parse main):foo
432
433
'
434
435
test_expect_success 'push ref expression with non-existent, incomplete dest' '
436
437
mk_test testrepo &&
438
- test_must_fail git push testrepo master^:branch
438
+ test_must_fail git push testrepo main^:branch
439
440
'
441
442
test_expect_success 'push with HEAD' '
443
444
- mk_test testrepo heads/master &&
445
- git checkout master &&
444
+ mk_test testrepo heads/main &&
445
+ git checkout main &&
446
git push testrepo HEAD &&
447
- check_push_result testrepo $the_commit heads/master
447
+ check_push_result testrepo $the_commit heads/main
448
449
'
450
451
test_expect_success 'push with HEAD nonexisting at remote' '
452
453
- mk_test testrepo heads/master &&
454
- git checkout -b local master &&
453
+ mk_test testrepo heads/main &&
454
+ git checkout -b local main &&
455
git push testrepo HEAD &&
456
check_push_result testrepo $the_commit heads/local
457
'
458
459
test_expect_success 'push with +HEAD' '
460
461
- mk_test testrepo heads/master &&
462
- git checkout master &&
461
+ mk_test testrepo heads/main &&
462
+ git checkout main &&
463
git branch -D local &&
464
git checkout -b local &&
465
- git push testrepo master local &&
466
- check_push_result testrepo $the_commit heads/master &&
465
+ git push testrepo main local &&
466
+ check_push_result testrepo $the_commit heads/main &&
467
check_push_result testrepo $the_commit heads/local &&
468
469
# Without force rewinding should fail
@@ -480,7 +480,7 @@ test_expect_success 'push with +HEAD' '
480
test_expect_success 'push HEAD with non-existent, incomplete dest' '
481
482
mk_test testrepo &&
483
- git checkout master &&
483
+ git checkout main &&
484
git push testrepo HEAD:branch &&
485
check_push_result testrepo $the_commit heads/branch
486
@@ -489,7 +489,7 @@ test_expect_success 'push HEAD with non-existent, incomplete dest' '
489
test_expect_success 'push with config remote.*.push = HEAD' '
490
491
mk_test testrepo heads/local &&
492
- git checkout master &&
492
+ git checkout main &&
493
git branch -f local $the_commit &&
494
(
495
cd testrepo &&
@@ -498,166 +498,166 @@ test_expect_success 'push with config remote.*.push = HEAD' '
498
) &&
499
test_config remote.there.url testrepo &&
500
test_config remote.there.push HEAD &&
501
- test_config branch.master.remote there &&
501
+ test_config branch.main.remote there &&
502
git push &&
503
- check_push_result testrepo $the_commit heads/master &&
503
+ check_push_result testrepo $the_commit heads/main &&
504
check_push_result testrepo $the_first_commit heads/local
505
'
506
507
test_expect_success 'push with remote.pushdefault' '
508
- mk_test up_repo heads/master &&
509
- mk_test down_repo heads/master &&
508
+ mk_test up_repo heads/main &&
509
+ mk_test down_repo heads/main &&
510
test_config remote.up.url up_repo &&
511
test_config remote.down.url down_repo &&
512
- test_config branch.master.remote up &&
512
+ test_config branch.main.remote up &&
513
test_config remote.pushdefault down &&
514
test_config push.default matching &&
515
git push &&
516
- check_push_result up_repo $the_first_commit heads/master &&
517
- check_push_result down_repo $the_commit heads/master
516
+ check_push_result up_repo $the_first_commit heads/main &&
517
+ check_push_result down_repo $the_commit heads/main
518
'
519
520
test_expect_success 'push with config remote.*.pushurl' '
521
522
- mk_test testrepo heads/master &&
523
- git checkout master &&
522
+ mk_test testrepo heads/main &&
523
+ git checkout main &&
524
test_config remote.there.url test2repo &&
525
test_config remote.there.pushurl testrepo &&
526
git push there : &&
527
- check_push_result testrepo $the_commit heads/master
527
+ check_push_result testrepo $the_commit heads/main
528
'
529
530
test_expect_success 'push with config branch.*.pushremote' '
531
- mk_test up_repo heads/master &&
532
- mk_test side_repo heads/master &&
533
- mk_test down_repo heads/master &&
531
+ mk_test up_repo heads/main &&
532
+ mk_test side_repo heads/main &&
533
+ mk_test down_repo heads/main &&
534
test_config remote.up.url up_repo &&
535
test_config remote.pushdefault side_repo &&
536
test_config remote.down.url down_repo &&
537
- test_config branch.master.remote up &&
538
- test_config branch.master.pushremote down &&
537
+ test_config branch.main.remote up &&
538
+ test_config branch.main.pushremote down &&
539
test_config push.default matching &&
540
git push &&
541
- check_push_result up_repo $the_first_commit heads/master &&
542
- check_push_result side_repo $the_first_commit heads/master &&
543
- check_push_result down_repo $the_commit heads/master
541
+ check_push_result up_repo $the_first_commit heads/main &&
542
+ check_push_result side_repo $the_first_commit heads/main &&
543
+ check_push_result down_repo $the_commit heads/main
544
'
545
546
test_expect_success 'branch.*.pushremote config order is irrelevant' '
547
- mk_test one_repo heads/master &&
548
- mk_test two_repo heads/master &&
547
+ mk_test one_repo heads/main &&
548
+ mk_test two_repo heads/main &&
549
test_config remote.one.url one_repo &&
550
test_config remote.two.url two_repo &&
551
- test_config branch.master.pushremote two_repo &&
551
+ test_config branch.main.pushremote two_repo &&
552
test_config remote.pushdefault one_repo &&
553
test_config push.default matching &&
554
git push &&
555
- check_push_result one_repo $the_first_commit heads/master &&
556
- check_push_result two_repo $the_commit heads/master
555
+ check_push_result one_repo $the_first_commit heads/main &&
556
+ check_push_result two_repo $the_commit heads/main
557
'
558
559
test_expect_success 'push with dry-run' '
560
561
- mk_test testrepo heads/master &&
562
- old_commit=$(git -C testrepo show-ref -s --verify refs/heads/master) &&
561
+ mk_test testrepo heads/main &&
562
+ old_commit=$(git -C testrepo show-ref -s --verify refs/heads/main) &&
563
git push --dry-run testrepo : &&
564
- check_push_result testrepo $old_commit heads/master
564
+ check_push_result testrepo $old_commit heads/main
565
'
566
567
test_expect_success 'push updates local refs' '
568
569
- mk_test testrepo heads/master &&
569
+ mk_test testrepo heads/main &&
570
mk_child testrepo child &&
571
(
572
cd child &&
573
- git pull .. master &&
573
+ git pull .. main &&
574
git push &&
575
- test $(git rev-parse master) = \
576
- $(git rev-parse remotes/origin/master)
575
+ test $(git rev-parse main) = \
576
+ $(git rev-parse remotes/origin/main)
577
)
578
579
'
580
581
test_expect_success 'push updates up-to-date local refs' '
582
583
- mk_test testrepo heads/master &&
583
+ mk_test testrepo heads/main &&
584
mk_child testrepo child1 &&
585
mk_child testrepo child2 &&
586
- (cd child1 && git pull .. master && git push) &&
586
+ (cd child1 && git pull .. main && git push) &&
587
(
588
cd child2 &&
589
- git pull ../child1 master &&
589
+ git pull ../child1 main &&
590
git push &&
591
- test $(git rev-parse master) = \
592
- $(git rev-parse remotes/origin/master)
591
+ test $(git rev-parse main) = \
592
+ $(git rev-parse remotes/origin/main)
593
)
594
595
'
596
597
test_expect_success 'push preserves up-to-date packed refs' '
598
599
- mk_test testrepo heads/master &&
599
+ mk_test testrepo heads/main &&
600
mk_child testrepo child &&
601
(
602
cd child &&
603
git push &&
604
- ! test -f .git/refs/remotes/origin/master
604
+ ! test -f .git/refs/remotes/origin/main
605
)
606
607
'
608
609
test_expect_success 'push does not update local refs on failure' '
610
611
- mk_test testrepo heads/master &&
611
+ mk_test testrepo heads/main &&
612
mk_child testrepo child &&
613
mkdir testrepo/.git/hooks &&
614
echo "#!/no/frobnication/today" >testrepo/.git/hooks/pre-receive &&
615
chmod +x testrepo/.git/hooks/pre-receive &&
616
(
617
cd child &&
618
- git pull .. master &&
618
+ git pull .. main &&
619
test_must_fail git push &&
620
- test $(git rev-parse master) != \
621
- $(git rev-parse remotes/origin/master)
620
+ test $(git rev-parse main) != \
621
+ $(git rev-parse remotes/origin/main)
622
)
623
624
'
625
626
test_expect_success 'allow deleting an invalid remote ref' '
627
628
- mk_test testrepo heads/master &&
628
+ mk_test testrepo heads/main &&
629
rm -f testrepo/.git/objects/??/* &&
630
- git push testrepo :refs/heads/master &&
631
- (cd testrepo && test_must_fail git rev-parse --verify refs/heads/master)
630
+ git push testrepo :refs/heads/main &&
631
+ (cd testrepo && test_must_fail git rev-parse --verify refs/heads/main)
632
633
'
634
635
test_expect_success 'pushing valid refs triggers post-receive and post-update hooks' '
636
- mk_test_with_hooks testrepo heads/master heads/next &&
637
- orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
638
- newmaster=$(git show-ref -s --verify refs/heads/master) &&
636
+ mk_test_with_hooks testrepo heads/main heads/next &&
637
+ orgmain=$(cd testrepo && git show-ref -s --verify refs/heads/main) &&
638
+ newmain=$(git show-ref -s --verify refs/heads/main) &&
639
orgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) &&
640
newnext=$ZERO_OID &&
641
- git push testrepo refs/heads/master:refs/heads/master :refs/heads/next &&
641
+ git push testrepo refs/heads/main:refs/heads/main :refs/heads/next &&
642
(
643
cd testrepo/.git &&
644
cat >pre-receive.expect <<-EOF &&
645
- $orgmaster $newmaster refs/heads/master
645
+ $orgmain $newmain refs/heads/main
646
$orgnext $newnext refs/heads/next
647
EOF
648
649
cat >update.expect <<-EOF &&
650
- refs/heads/master $orgmaster $newmaster
650
+ refs/heads/main $orgmain $newmain
651
refs/heads/next $orgnext $newnext
652
EOF
653
654
cat >post-receive.expect <<-EOF &&
655
- $orgmaster $newmaster refs/heads/master
655
+ $orgmain $newmain refs/heads/main
656
$orgnext $newnext refs/heads/next
657
EOF
658
659
cat >post-update.expect <<-EOF &&
660
- refs/heads/master
660
+ refs/heads/main
661
refs/heads/next
662
EOF
663
@@ -669,25 +669,25 @@ test_expect_success 'pushing valid refs triggers post-receive and post-update ho
669
'
670
671
test_expect_success 'deleting dangling ref triggers hooks with correct args' '
672
- mk_test_with_hooks testrepo heads/master &&
672
+ mk_test_with_hooks testrepo heads/main &&
673
rm -f testrepo/.git/objects/??/* &&
674
- git push testrepo :refs/heads/master &&
674
+ git push testrepo :refs/heads/main &&
675
(
676
cd testrepo/.git &&
677
cat >pre-receive.expect <<-EOF &&
678
- $ZERO_OID $ZERO_OID refs/heads/master
678
+ $ZERO_OID $ZERO_OID refs/heads/main
679
EOF
680
681
cat >update.expect <<-EOF &&
682
- refs/heads/master $ZERO_OID $ZERO_OID
682
+ refs/heads/main $ZERO_OID $ZERO_OID
683
EOF
684
685
cat >post-receive.expect <<-EOF &&
686
- $ZERO_OID $ZERO_OID refs/heads/master
686
+ $ZERO_OID $ZERO_OID refs/heads/main
687
EOF
688
689
cat >post-update.expect <<-EOF &&
690
- refs/heads/master
690
+ refs/heads/main
691
EOF
692
693
test_cmp pre-receive.expect pre-receive.actual &&
@@ -698,28 +698,28 @@ test_expect_success 'deleting dangling ref triggers hooks with correct args' '
698
'
699
700
test_expect_success 'deletion of a non-existent ref is not fed to post-receive and post-update hooks' '
701
- mk_test_with_hooks testrepo heads/master &&
702
- orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
703
- newmaster=$(git show-ref -s --verify refs/heads/master) &&
704
- git push testrepo master :refs/heads/nonexistent &&
701
+ mk_test_with_hooks testrepo heads/main &&
702
+ orgmain=$(cd testrepo && git show-ref -s --verify refs/heads/main) &&
703
+ newmain=$(git show-ref -s --verify refs/heads/main) &&
704
+ git push testrepo main :refs/heads/nonexistent &&
705
(
706
cd testrepo/.git &&
707
cat >pre-receive.expect <<-EOF &&
708
- $orgmaster $newmaster refs/heads/master
708
+ $orgmain $newmain refs/heads/main
709
$ZERO_OID $ZERO_OID refs/heads/nonexistent
710
EOF
711
712
cat >update.expect <<-EOF &&
713
- refs/heads/master $orgmaster $newmaster
713
+ refs/heads/main $orgmain $newmain
714
refs/heads/nonexistent $ZERO_OID $ZERO_OID
715
EOF
716
717
cat >post-receive.expect <<-EOF &&
718
- $orgmaster $newmaster refs/heads/master
718
+ $orgmain $newmain refs/heads/main
719
EOF
720
721
cat >post-update.expect <<-EOF &&
722
- refs/heads/master
722
+ refs/heads/main
723
EOF
724
725
test_cmp pre-receive.expect pre-receive.actual &&
@@ -730,7 +730,7 @@ test_expect_success 'deletion of a non-existent ref is not fed to post-receive a
730
'
731
732
test_expect_success 'deletion of a non-existent ref alone does trigger post-receive and post-update hooks' '
733
- mk_test_with_hooks testrepo heads/master &&
733
+ mk_test_with_hooks testrepo heads/main &&
734
git push testrepo :refs/heads/nonexistent &&
735
(
736
cd testrepo/.git &&
@@ -750,40 +750,40 @@ test_expect_success 'deletion of a non-existent ref alone does trigger post-rece
750
'
751
752
test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks with correct input' '
753
- mk_test_with_hooks testrepo heads/master heads/next heads/seen &&
754
- orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
755
- newmaster=$(git show-ref -s --verify refs/heads/master) &&
753
+ mk_test_with_hooks testrepo heads/main heads/next heads/seen &&
754
+ orgmain=$(cd testrepo && git show-ref -s --verify refs/heads/main) &&
755
+ newmain=$(git show-ref -s --verify refs/heads/main) &&
756
orgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) &&
757
newnext=$ZERO_OID &&
758
orgseen=$(cd testrepo && git show-ref -s --verify refs/heads/seen) &&
759
- newseen=$(git show-ref -s --verify refs/heads/master) &&
760
- git push testrepo refs/heads/master:refs/heads/master \
761
- refs/heads/master:refs/heads/seen :refs/heads/next \
759
+ newseen=$(git show-ref -s --verify refs/heads/main) &&
760
+ git push testrepo refs/heads/main:refs/heads/main \
761
+ refs/heads/main:refs/heads/seen :refs/heads/next \
762
:refs/heads/nonexistent &&
763
(
764
cd testrepo/.git &&
765
cat >pre-receive.expect <<-EOF &&
766
- $orgmaster $newmaster refs/heads/master
766
+ $orgmain $newmain refs/heads/main
767
$orgnext $newnext refs/heads/next
768
$orgseen $newseen refs/heads/seen
769
$ZERO_OID $ZERO_OID refs/heads/nonexistent
770
EOF
771
772
cat >update.expect <<-EOF &&
773
- refs/heads/master $orgmaster $newmaster
773
+ refs/heads/main $orgmain $newmain
774
refs/heads/next $orgnext $newnext
775
refs/heads/seen $orgseen $newseen
776
refs/heads/nonexistent $ZERO_OID $ZERO_OID
777
EOF
778
779
cat >post-receive.expect <<-EOF &&
780
- $orgmaster $newmaster refs/heads/master
780
+ $orgmain $newmain refs/heads/main
781
$orgnext $newnext refs/heads/next
782
$orgseen $newseen refs/heads/seen
783
EOF
784
785
cat >post-update.expect <<-EOF &&
786
- refs/heads/master
786
+ refs/heads/main
787
refs/heads/next
788
refs/heads/seen
789
EOF
@@ -796,15 +796,15 @@ test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks w
796
'
797
798
test_expect_success 'allow deleting a ref using --delete' '
799
- mk_test testrepo heads/master &&
799
+ mk_test testrepo heads/main &&
800
(cd testrepo && git config receive.denyDeleteCurrent warn) &&
801
- git push testrepo --delete master &&
802
- (cd testrepo && test_must_fail git rev-parse --verify refs/heads/master)
801
+ git push testrepo --delete main &&
802
+ (cd testrepo && test_must_fail git rev-parse --verify refs/heads/main)
803
'
804
805
test_expect_success 'allow deleting a tag using --delete' '
806
- mk_test testrepo heads/master &&
807
- git tag -a -m dummy_message deltag heads/master &&
806
+ mk_test testrepo heads/main &&
807
+ git tag -a -m dummy_message deltag heads/main &&
808
git push testrepo --tags &&
809
(cd testrepo && git rev-parse --verify -q refs/tags/deltag) &&
810
git push testrepo --delete tag deltag &&
@@ -812,56 +812,56 @@ test_expect_success 'allow deleting a tag using --delete' '
812
'
813
814
test_expect_success 'push --delete without args aborts' '
815
- mk_test testrepo heads/master &&
815
+ mk_test testrepo heads/main &&
816
test_must_fail git push testrepo --delete
817
'
818
819
test_expect_success 'push --delete refuses src:dest refspecs' '
820
- mk_test testrepo heads/master &&
821
- test_must_fail git push testrepo --delete master:foo
820
+ mk_test testrepo heads/main &&
821
+ test_must_fail git push testrepo --delete main:foo
822
'
823
824
test_expect_success 'warn on push to HEAD of non-bare repository' '
825
- mk_test testrepo heads/master &&
825
+ mk_test testrepo heads/main &&
826
(
827
cd testrepo &&
828
- git checkout master &&
828
+ git checkout main &&
829
git config receive.denyCurrentBranch warn
830
) &&
831
- git push testrepo master 2>stderr &&
831
+ git push testrepo main 2>stderr &&
832
grep "warning: updating the current branch" stderr
833
'
834
835
test_expect_success 'deny push to HEAD of non-bare repository' '
836
- mk_test testrepo heads/master &&
836
+ mk_test testrepo heads/main &&
837
(
838
cd testrepo &&
839
- git checkout master &&
839
+ git checkout main &&
840
git config receive.denyCurrentBranch true
841
) &&
842
- test_must_fail git push testrepo master
842
+ test_must_fail git push testrepo main
843
'
844
845
test_expect_success 'allow push to HEAD of bare repository (bare)' '
846
- mk_test testrepo heads/master &&
846
+ mk_test testrepo heads/main &&
847
(
848
cd testrepo &&
849
- git checkout master &&
849
+ git checkout main &&
850
git config receive.denyCurrentBranch true &&
851
git config core.bare true
852
) &&
853
- git push testrepo master 2>stderr &&
853
+ git push testrepo main 2>stderr &&
854
! grep "warning: updating the current branch" stderr
855
'
856
857
test_expect_success 'allow push to HEAD of non-bare repository (config)' '
858
- mk_test testrepo heads/master &&
858
+ mk_test testrepo heads/main &&
859
(
860
cd testrepo &&
861
- git checkout master &&
861
+ git checkout main &&
862
git config receive.denyCurrentBranch false
863
) &&
864
- git push testrepo master 2>stderr &&
864
+ git push testrepo main 2>stderr &&
865
! grep "warning: updating the current branch" stderr
866
'
867
@@ -877,7 +877,7 @@ test_expect_success 'fetch with branches' '
877
git for-each-ref refs/heads >actual &&
878
test_cmp expect actual
879
) &&
880
- git checkout master
880
+ git checkout main
881
'
882
883
test_expect_success 'fetch with branches containing #' '
@@ -890,7 +890,7 @@ test_expect_success 'fetch with branches containing #' '
890
git for-each-ref refs/heads >actual &&
891
test_cmp expect actual
892
) &&
893
- git checkout master
893
+ git checkout main
894
'
895
896
test_expect_success 'push with branches' '
@@ -900,7 +900,7 @@ test_expect_success 'push with branches' '
900
git push branch1 &&
901
(
902
cd testrepo &&
903
- echo "$the_first_commit commit refs/heads/master" >expect &&
903
+ echo "$the_first_commit commit refs/heads/main" >expect &&
904
git for-each-ref refs/heads >actual &&
905
test_cmp expect actual
906
)
@@ -916,11 +916,11 @@ test_expect_success 'push with branches containing #' '
916
git for-each-ref refs/heads >actual &&
917
test_cmp expect actual
918
) &&
919
- git checkout master
919
+ git checkout main
920
'
921
922
test_expect_success 'push into aliased refs (consistent)' '
923
- mk_test testrepo heads/master &&
923
+ mk_test testrepo heads/main &&
924
mk_child testrepo child1 &&
925
mk_child testrepo child2 &&
926
(
@@ -942,7 +942,7 @@ test_expect_success 'push into aliased refs (consistent)' '
942
'
943
944
test_expect_success 'push into aliased refs (inconsistent)' '
945
- mk_test testrepo heads/master &&
945
+ mk_test testrepo heads/main &&
946
mk_child testrepo child1 &&
947
mk_child testrepo child2 &&
948
(
@@ -973,7 +973,7 @@ test_force_push_tag () {
973
tag_args=$2
974
975
test_expect_success "force pushing required to update $tag_type_description" "
976
- mk_test testrepo heads/master &&
976
+ mk_test testrepo heads/main &&
977
mk_child testrepo child1 &&
978
mk_child testrepo child2 &&
979
(
@@ -1019,7 +1019,7 @@ test_force_fetch_tag () {
1019
tag_args=$2
1020
1021
test_expect_success "fetch will not clobber an existing $tag_type_description without --force" "
1022
- mk_test testrepo heads/master &&
1022
+ mk_test testrepo heads/main &&
1023
mk_child testrepo child1 &&
1024
mk_child testrepo child2 &&
1025
(
@@ -1042,12 +1042,12 @@ test_force_fetch_tag "annotated tag" "-f -a -m'tag message'"
1042
test_expect_success 'push --porcelain' '
1043
mk_empty testrepo &&
1044
echo >.git/foo "To testrepo" &&
1045
- echo >>.git/foo "* refs/heads/master:refs/remotes/origin/master [new reference]" &&
1045
+ echo >>.git/foo "* refs/heads/main:refs/remotes/origin/main [new reference]" &&
1046
echo >>.git/foo "Done" &&
1047
- git push >.git/bar --porcelain testrepo refs/heads/master:refs/remotes/origin/master &&
1047
+ git push >.git/bar --porcelain testrepo refs/heads/main:refs/remotes/origin/main &&
1048
(
1049
cd testrepo &&
1050
- echo "$the_commit commit refs/remotes/origin/master" >expect &&
1050
+ echo "$the_commit commit refs/remotes/origin/main" >expect &&
1051
git for-each-ref refs/remotes/origin >actual &&
1052
test_cmp expect actual
1053
) &&
@@ -1056,52 +1056,52 @@ test_expect_success 'push --porcelain' '
1056
1057
test_expect_success 'push --porcelain bad url' '
1058
mk_empty testrepo &&
1059
- test_must_fail git push >.git/bar --porcelain asdfasdfasd refs/heads/master:refs/remotes/origin/master &&
1059
+ test_must_fail git push >.git/bar --porcelain asdfasdfasd refs/heads/main:refs/remotes/origin/main &&
1060
! grep -q Done .git/bar
1061
'
1062
1063
test_expect_success 'push --porcelain rejected' '
1064
mk_empty testrepo &&
1065
- git push testrepo refs/heads/master:refs/remotes/origin/master &&
1065
+ git push testrepo refs/heads/main:refs/remotes/origin/main &&
1066
(cd testrepo &&
1067
- git reset --hard origin/master^ &&
1067
+ git reset --hard origin/main^ &&
1068
git config receive.denyCurrentBranch true) &&
1069
1070
echo >.git/foo "To testrepo" &&
1071
- echo >>.git/foo "! refs/heads/master:refs/heads/master [remote rejected] (branch is currently checked out)" &&
1071
+ echo >>.git/foo "! refs/heads/main:refs/heads/main [remote rejected] (branch is currently checked out)" &&
1072
echo >>.git/foo "Done" &&
1073
1074
- test_must_fail git push >.git/bar --porcelain testrepo refs/heads/master:refs/heads/master &&
1074
+ test_must_fail git push >.git/bar --porcelain testrepo refs/heads/main:refs/heads/main &&
1075
test_cmp .git/foo .git/bar
1076
'
1077
1078
test_expect_success 'push --porcelain --dry-run rejected' '
1079
mk_empty testrepo &&
1080
- git push testrepo refs/heads/master:refs/remotes/origin/master &&
1080
+ git push testrepo refs/heads/main:refs/remotes/origin/main &&
1081
(cd testrepo &&
1082
- git reset --hard origin/master &&
1082
+ git reset --hard origin/main &&
1083
git config receive.denyCurrentBranch true) &&
1084
1085
echo >.git/foo "To testrepo" &&
1086
- echo >>.git/foo "! refs/heads/master^:refs/heads/master [rejected] (non-fast-forward)" &&
1086
+ echo >>.git/foo "! refs/heads/main^:refs/heads/main [rejected] (non-fast-forward)" &&
1087
echo >>.git/foo "Done" &&
1088
1089
- test_must_fail git push >.git/bar --porcelain --dry-run testrepo refs/heads/master^:refs/heads/master &&
1089
+ test_must_fail git push >.git/bar --porcelain --dry-run testrepo refs/heads/main^:refs/heads/main &&
1090
test_cmp .git/foo .git/bar
1091
'
1092
1093
test_expect_success 'push --prune' '
1094
- mk_test testrepo heads/master heads/second heads/foo heads/bar &&
1094
+ mk_test testrepo heads/main heads/second heads/foo heads/bar &&
1095
git push --prune testrepo : &&
1096
- check_push_result testrepo $the_commit heads/master &&
1096
+ check_push_result testrepo $the_commit heads/main &&
1097
check_push_result testrepo $the_first_commit heads/second &&
1098
! check_push_result testrepo $the_first_commit heads/foo heads/bar
1099
'
1100
1101
test_expect_success 'push --prune refspec' '
1102
- mk_test testrepo tmp/master tmp/second tmp/foo tmp/bar &&
1102
+ mk_test testrepo tmp/main tmp/second tmp/foo tmp/bar &&
1103
git push --prune testrepo "refs/heads/*:refs/tmp/*" &&
1104
- check_push_result testrepo $the_commit tmp/master &&
1104
+ check_push_result testrepo $the_commit tmp/main &&
1105
check_push_result testrepo $the_first_commit tmp/second &&
1106
! check_push_result testrepo $the_first_commit tmp/foo tmp/bar
1107
'
@@ -1109,18 +1109,18 @@ test_expect_success 'push --prune refspec' '
1109
for configsection in transfer receive
1110
do
1111
test_expect_success "push to update a ref hidden by $configsection.hiderefs" '
1112
- mk_test testrepo heads/master hidden/one hidden/two hidden/three &&
1112
+ mk_test testrepo heads/main hidden/one hidden/two hidden/three &&
1113
(
1114
cd testrepo &&
1115
git config $configsection.hiderefs refs/hidden
1116
) &&
1117
1118
# push to unhidden ref succeeds normally
1119
- git push testrepo master:refs/heads/master &&
1120
- check_push_result testrepo $the_commit heads/master &&
1119
+ git push testrepo main:refs/heads/main &&
1120
+ check_push_result testrepo $the_commit heads/main &&
1121
1122
# push to update a hidden ref should fail
1123
- test_must_fail git push testrepo master:refs/hidden/one &&
1123
+ test_must_fail git push testrepo main:refs/hidden/one &&
1124
check_push_result testrepo $the_first_commit hidden/one &&
1125
1126
# push to delete a hidden ref should fail
@@ -1134,8 +1134,8 @@ do
1134
done
1135
1136
test_expect_success 'fetch exact SHA1' '
1137
- mk_test testrepo heads/master hidden/one &&
1138
- git push testrepo master:refs/hidden/one &&
1137
+ mk_test testrepo heads/main hidden/one &&
1138
+ git push testrepo main:refs/hidden/one &&
1139
(
1140
cd testrepo &&
1141
git config transfer.hiderefs refs/hidden
@@ -1166,7 +1166,7 @@ test_expect_success 'fetch exact SHA1' '
1166
git config uploadpack.allowtipsha1inwant true
1167
) &&
1168
1169
- git fetch -v ../testrepo $the_commit:refs/heads/copy master:refs/heads/extra &&
1169
+ git fetch -v ../testrepo $the_commit:refs/heads/copy main:refs/heads/extra &&
1170
cat >expect <<-EOF &&
1171
$the_commit
1172
$the_first_commit
@@ -1180,8 +1180,8 @@ test_expect_success 'fetch exact SHA1' '
1180
'
1181
1182
test_expect_success 'fetch exact SHA1 in protocol v2' '
1183
- mk_test testrepo heads/master hidden/one &&
1184
- git push testrepo master:refs/hidden/one &&
1183
+ mk_test testrepo heads/main hidden/one &&
1184
+ git push testrepo main:refs/hidden/one &&
1185
git -C testrepo config transfer.hiderefs refs/hidden &&
1186
check_push_result testrepo $the_commit hidden/one &&
1187
@@ -1263,17 +1263,17 @@ do
1263
done
1264
1265
test_expect_success 'fetch follows tags by default' '
1266
- mk_test testrepo heads/master &&
1266
+ mk_test testrepo heads/main &&
1267
rm -fr src dst &&
1268
git init src &&
1269
(
1270
cd src &&
1271
- git pull ../testrepo master &&
1271
+ git pull ../testrepo main &&
1272
git tag -m "annotated" tag &&
1273
git for-each-ref >tmp1 &&
1274
(
1275
cat tmp1
1276
- sed -n "s|refs/heads/master$|refs/remotes/origin/master|p" tmp1
1276
+ sed -n "s|refs/heads/main$|refs/remotes/origin/main|p" tmp1
1277
) |
1278
sort -k 3 >../expect
1279
) &&
@@ -1281,8 +1281,8 @@ test_expect_success 'fetch follows tags by default' '
1281
(
1282
cd dst &&
1283
git remote add origin ../src &&
1284
- git config branch.master.remote origin &&
1285
- git config branch.master.merge refs/heads/master &&
1284
+ git config branch.main.remote origin &&
1285
+ git config branch.main.merge refs/heads/main &&
1286
git pull &&
1287
git for-each-ref >../actual
1288
) &&
@@ -1301,74 +1301,74 @@ test_expect_success 'peeled advertisements are not considered ref tips' '
1301
'
1302
1303
test_expect_success 'pushing a specific ref applies remote.$name.push as refmap' '
1304
- mk_test testrepo heads/master &&
1304
+ mk_test testrepo heads/main &&
1305
rm -fr src dst &&
1306
git init src &&
1307
git init --bare dst &&
1308
(
1309
cd src &&
1310
- git pull ../testrepo master &&
1310
+ git pull ../testrepo main &&
1311
git branch next &&
1312
git config remote.dst.url ../dst &&
1313
git config remote.dst.push "+refs/heads/*:refs/remotes/src/*" &&
1314
- git push dst master &&
1315
- git show-ref refs/heads/master |
1314
+ git push dst main &&
1315
+ git show-ref refs/heads/main |
1316
sed -e "s|refs/heads/|refs/remotes/src/|" >../dst/expect
1317
) &&
1318
(
1319
cd dst &&
1320
test_must_fail git show-ref refs/heads/next &&
1321
- test_must_fail git show-ref refs/heads/master &&
1322
- git show-ref refs/remotes/src/master >actual
1321
+ test_must_fail git show-ref refs/heads/main &&
1322
+ git show-ref refs/remotes/src/main >actual
1323
) &&
1324
test_cmp dst/expect dst/actual
1325
'
1326
1327
test_expect_success 'with no remote.$name.push, it is not used as refmap' '
1328
- mk_test testrepo heads/master &&
1328
+ mk_test testrepo heads/main &&
1329
rm -fr src dst &&
1330
git init src &&
1331
git init --bare dst &&
1332
(
1333
cd src &&
1334
- git pull ../testrepo master &&
1334
+ git pull ../testrepo main &&
1335
git branch next &&
1336
git config remote.dst.url ../dst &&
1337
git config push.default matching &&
1338
- git push dst master &&
1339
- git show-ref refs/heads/master >../dst/expect
1338
+ git push dst main &&
1339
+ git show-ref refs/heads/main >../dst/expect
1340
) &&
1341
(
1342
cd dst &&
1343
test_must_fail git show-ref refs/heads/next &&
1344
- git show-ref refs/heads/master >actual
1344
+ git show-ref refs/heads/main >actual
1345
) &&
1346
test_cmp dst/expect dst/actual
1347
'
1348
1349
test_expect_success 'with no remote.$name.push, upstream mapping is used' '
1350
- mk_test testrepo heads/master &&
1350
+ mk_test testrepo heads/main &&
1351
rm -fr src dst &&
1352
git init src &&
1353
git init --bare dst &&
1354
(
1355
cd src &&
1356
- git pull ../testrepo master &&
1356
+ git pull ../testrepo main &&
1357
git branch next &&
1358
git config remote.dst.url ../dst &&
1359
git config remote.dst.fetch "+refs/heads/*:refs/remotes/dst/*" &&
1360
git config push.default upstream &&
1361
1362
- git config branch.master.merge refs/heads/trunk &&
1363
- git config branch.master.remote dst &&
1362
+ git config branch.main.merge refs/heads/trunk &&
1363
+ git config branch.main.remote dst &&
1364
1365
- git push dst master &&
1366
- git show-ref refs/heads/master |
1367
- sed -e "s|refs/heads/master|refs/heads/trunk|" >../dst/expect
1365
+ git push dst main &&
1366
+ git show-ref refs/heads/main |
1367
+ sed -e "s|refs/heads/main|refs/heads/trunk|" >../dst/expect
1368
) &&
1369
(
1370
cd dst &&
1371
- test_must_fail git show-ref refs/heads/master &&
1371
+ test_must_fail git show-ref refs/heads/main &&
1372
test_must_fail git show-ref refs/heads/next &&
1373
git show-ref refs/heads/trunk >actual
1374
) &&
@@ -1376,20 +1376,20 @@ test_expect_success 'with no remote.$name.push, upstream mapping is used' '
1376
'
1377
1378
test_expect_success 'push does not follow tags by default' '
1379
- mk_test testrepo heads/master &&
1379
+ mk_test testrepo heads/main &&
1380
rm -fr src dst &&
1381
git init src &&
1382
git init --bare dst &&
1383
(
1384
cd src &&
1385
- git pull ../testrepo master &&
1385
+ git pull ../testrepo main &&
1386
git tag -m "annotated" tag &&
1387
git checkout -b another &&
1388
git commit --allow-empty -m "future commit" &&
1389
git tag -m "future" future &&
1390
- git checkout master &&
1391
- git for-each-ref refs/heads/master >../expect &&
1392
- git push ../dst master
1390
+ git checkout main &&
1391
+ git for-each-ref refs/heads/main >../expect &&
1392
+ git push ../dst main
1393
) &&
1394
(
1395
cd dst &&
@@ -1399,20 +1399,20 @@ test_expect_success 'push does not follow tags by default' '
1399
'
1400
1401
test_expect_success 'push --follow-tags only pushes relevant tags' '
1402
- mk_test testrepo heads/master &&
1402
+ mk_test testrepo heads/main &&
1403
rm -fr src dst &&
1404
git init src &&
1405
git init --bare dst &&
1406
(
1407
cd src &&
1408
- git pull ../testrepo master &&
1408
+ git pull ../testrepo main &&
1409
git tag -m "annotated" tag &&
1410
git checkout -b another &&
1411
git commit --allow-empty -m "future commit" &&
1412
git tag -m "future" future &&
1413
- git checkout master &&
1414
- git for-each-ref refs/heads/master refs/tags/tag >../expect &&
1415
- git push --follow-tags ../dst master
1413
+ git checkout main &&
1414
+ git for-each-ref refs/heads/main refs/tags/tag >../expect &&
1415
+ git push --follow-tags ../dst main
1416
) &&
1417
(
1418
cd dst &&
@@ -1430,12 +1430,12 @@ EOF
1430
git commit -am initial &&
1431
git init no-thin &&
1432
git --git-dir=no-thin/.git config receive.unpacklimit 0 &&
1433
- git push no-thin/.git refs/heads/master:refs/heads/foo &&
1433
+ git push no-thin/.git refs/heads/main:refs/heads/foo &&
1434
echo modified >> path1 &&
1435
git commit -am modified &&
1436
git repack -adf &&
1437
rcvpck="git receive-pack --reject-thin-pack-for-testing" &&
1438
- git push --no-thin --receive-pack="$rcvpck" no-thin/.git refs/heads/master:refs/heads/foo
1438
+ git push --no-thin --receive-pack="$rcvpck" no-thin/.git refs/heads/main:refs/heads/foo
1439
'
1440
1441
test_expect_success 'pushing a tag pushes the tagged object' '
@@ -1458,12 +1458,12 @@ test_expect_success 'push into bare respects core.logallrefupdates' '
1458
1459
# double push to test both with and without
1460
# the actual pack transfer
1461
- git push dst.git master:one &&
1461
+ git push dst.git main:one &&
1462
echo "one@{0} push" >expect &&
1463
git -C dst.git log -g --format="%gd %gs" one >actual &&
1464
test_cmp expect actual &&
1465
1466
- git push dst.git master:two &&
1466
+ git push dst.git main:two &&
1467
echo "two@{0} push" >expect &&
1468
git -C dst.git log -g --format="%gd %gs" two >actual &&
1469
test_cmp expect actual
@@ -1478,20 +1478,20 @@ test_expect_success 'fetch into bare respects core.logallrefupdates' '
1478
1479
# as above, we double-fetch to test both
1480
# with and without pack transfer
1481
- git fetch .. master:one &&
1482
- echo "one@{0} fetch .. master:one: storing head" >expect &&
1481
+ git fetch .. main:one &&
1482
+ echo "one@{0} fetch .. main:one: storing head" >expect &&
1483
git log -g --format="%gd %gs" one >actual &&
1484
test_cmp expect actual &&
1485
1486
- git fetch .. master:two &&
1487
- echo "two@{0} fetch .. master:two: storing head" >expect &&
1486
+ git fetch .. main:two &&
1487
+ echo "two@{0} fetch .. main:two: storing head" >expect &&
1488
git log -g --format="%gd %gs" two >actual &&
1489
test_cmp expect actual
1490
)
1491
'
1492
1493
test_expect_success 'receive.denyCurrentBranch = updateInstead' '
1494
- git push testrepo master &&
1494
+ git push testrepo main &&
1495
(
1496
cd testrepo &&
1497
git reset --hard &&
@@ -1500,7 +1500,7 @@ test_expect_success 'receive.denyCurrentBranch = updateInstead' '
1500
test_commit third path2 &&
1501
1502
# Try pushing into a repository with pristine working tree
1503
- git push testrepo master &&
1503
+ git push testrepo main &&
1504
(
1505
cd testrepo &&
1506
git update-index -q --refresh &&
@@ -1517,7 +1517,7 @@ test_expect_success 'receive.denyCurrentBranch = updateInstead' '
1517
test $(git -C .. rev-parse HEAD^) = $(git rev-parse HEAD) &&
1518
test-tool chmtime +100 path1
1519
) &&
1520
- git push testrepo master &&
1520
+ git push testrepo main &&
1521
(
1522
cd testrepo &&
1523
git update-index -q --refresh &&
@@ -1537,7 +1537,7 @@ test_expect_success 'receive.denyCurrentBranch = updateInstead' '
1537
cd testrepo &&
1538
echo changed >path1
1539
) &&
1540
- test_must_fail git push testrepo master &&
1540
+ test_must_fail git push testrepo main &&
1541
(
1542
cd testrepo &&
1543
test $(git -C .. rev-parse HEAD^) = $(git rev-parse HEAD) &&
@@ -1551,7 +1551,7 @@ test_expect_success 'receive.denyCurrentBranch = updateInstead' '
1551
echo changed >path1 &&
1552
git add path1
1553
) &&
1554
- test_must_fail git push testrepo master &&
1554
+ test_must_fail git push testrepo main &&
1555
(
1556
cd testrepo &&
1557
test $(git -C .. rev-parse HEAD^) = $(git rev-parse HEAD) &&
@@ -1568,7 +1568,7 @@ test_expect_success 'receive.denyCurrentBranch = updateInstead' '
1568
git reset --hard &&
1569
echo changed >path3
1570
) &&
1571
- test_must_fail git push testrepo master &&
1571
+ test_must_fail git push testrepo main &&
1572
(
1573
cd testrepo &&
1574
test $(git -C .. rev-parse HEAD^^) = $(git rev-parse HEAD) &&
@@ -1584,7 +1584,7 @@ test_expect_success 'receive.denyCurrentBranch = updateInstead' '
1584
echo fifth >path3 &&
1585
git add path3
1586
) &&
1587
- test_must_fail git push testrepo master &&
1587
+ test_must_fail git push testrepo main &&
1588
(
1589
cd testrepo &&
1590
test $(git -C .. rev-parse HEAD^^) = $(git rev-parse HEAD) &&
@@ -1599,17 +1599,17 @@ test_expect_success 'receive.denyCurrentBranch = updateInstead' '
1599
cd void &&
1600
git config receive.denyCurrentBranch updateInstead
1601
) &&
1602
- git push void master &&
1602
+ git push void main &&
1603
(
1604
cd void &&
1605
- test $(git -C .. rev-parse master) = $(git rev-parse HEAD) &&
1605
+ test $(git -C .. rev-parse main) = $(git rev-parse HEAD) &&
1606
git diff --quiet &&
1607
git diff --cached --quiet
1608
) &&
1609
1610
# (6) updateInstead intervened by fast-forward check
1611
- test_must_fail git push void master^:master &&
1612
- test $(git -C void rev-parse HEAD) = $(git rev-parse master) &&
1611
+ test_must_fail git push void main^:main &&
1612
+ test $(git -C void rev-parse HEAD) = $(git rev-parse main) &&
1613
git -C void diff --quiet &&
1614
git -C void diff --cached --quiet
1615
'
@@ -1619,7 +1619,7 @@ test_expect_success 'updateInstead with push-to-checkout hook' '
1619
git init testrepo &&
1620
(
1621
cd testrepo &&
1622
- git pull .. master &&
1622
+ git pull .. main &&
1623
git reset --hard HEAD^^ &&
1624
git tag initial &&
1625
git config receive.denyCurrentBranch updateInstead &&
@@ -1637,7 +1637,7 @@ test_expect_success 'updateInstead with push-to-checkout hook' '
1637
) &&
1638
1639
# Try pushing into a pristine
1640
- git push testrepo master &&
1640
+ git push testrepo main &&
1641
(
1642
cd testrepo &&
1643
git diff --quiet &&
@@ -1651,7 +1651,7 @@ test_expect_success 'updateInstead with push-to-checkout hook' '
1651
git reset --hard initial &&
1652
echo conflicting >path2
1653
) &&
1654
- test_must_fail git push testrepo master &&
1654
+ test_must_fail git push testrepo main &&
1655
(
1656
cd testrepo &&
1657
test $(git rev-parse initial) = $(git rev-parse HEAD) &&
@@ -1667,7 +1667,7 @@ test_expect_success 'updateInstead with push-to-checkout hook' '
1667
echo irrelevant >path5 &&
1668
git add path5
1669
) &&
1670
- git push testrepo master &&
1670
+ git push testrepo main &&
1671
(
1672
cd testrepo &&
1673
test "$(cat path1)" = unrelated &&
@@ -1707,7 +1707,7 @@ test_expect_success 'updateInstead with push-to-checkout hook' '
1707
EOF
1708
) &&
1709
1710
- git push void master &&
1710
+ git push void main &&
1711
(
1712
cd void &&
1713
git diff --quiet &&
t/t5517-push-mirror.sh
+63
-63
@@ -2,7 +2,7 @@
2
3
test_description='pushing to a mirror repository'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -18,16 +18,16 @@ invert () {
18
}
19
20
mk_repo_pair () {
21
- rm -rf master mirror &&
21
+ rm -rf main mirror &&
22
mkdir mirror &&
23
(
24
cd mirror &&
25
git init &&
26
git config receive.denyCurrentBranch warn
27
) &&
28
- mkdir master &&
28
+ mkdir main &&
29
(
30
- cd master &&
30
+ cd main &&
31
git init &&
32
git remote add $1 up ../mirror
33
)
@@ -39,13 +39,13 @@ test_expect_success 'push mirror creates new branches' '
39
40
mk_repo_pair &&
41
(
42
- cd master &&
42
+ cd main &&
43
echo one >foo && git add foo && git commit -m one &&
44
git push --mirror up
45
) &&
46
- master_master=$(cd master && git show-ref -s --verify refs/heads/master) &&
47
- mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) &&
48
- test "$master_master" = "$mirror_master"
46
+ main_main=$(cd main && git show-ref -s --verify refs/heads/main) &&
47
+ mirror_main=$(cd mirror && git show-ref -s --verify refs/heads/main) &&
48
+ test "$main_main" = "$mirror_main"
49
50
'
51
@@ -53,15 +53,15 @@ test_expect_success 'push mirror updates existing branches' '
53
54
mk_repo_pair &&
55
(
56
- cd master &&
56
+ cd main &&
57
echo one >foo && git add foo && git commit -m one &&
58
git push --mirror up &&
59
echo two >foo && git add foo && git commit -m two &&
60
git push --mirror up
61
) &&
62
- master_master=$(cd master && git show-ref -s --verify refs/heads/master) &&
63
- mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) &&
64
- test "$master_master" = "$mirror_master"
62
+ main_main=$(cd main && git show-ref -s --verify refs/heads/main) &&
63
+ mirror_main=$(cd mirror && git show-ref -s --verify refs/heads/main) &&
64
+ test "$main_main" = "$mirror_main"
65
66
'
67
@@ -69,7 +69,7 @@ test_expect_success 'push mirror force updates existing branches' '
69
70
mk_repo_pair &&
71
(
72
- cd master &&
72
+ cd main &&
73
echo one >foo && git add foo && git commit -m one &&
74
git push --mirror up &&
75
echo two >foo && git add foo && git commit -m two &&
@@ -77,9 +77,9 @@ test_expect_success 'push mirror force updates existing branches' '
77
git reset --hard HEAD^ &&
78
git push --mirror up
79
) &&
80
- master_master=$(cd master && git show-ref -s --verify refs/heads/master) &&
81
- mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) &&
82
- test "$master_master" = "$mirror_master"
80
+ main_main=$(cd main && git show-ref -s --verify refs/heads/main) &&
81
+ mirror_main=$(cd mirror && git show-ref -s --verify refs/heads/main) &&
82
+ test "$main_main" = "$mirror_main"
83
84
'
85
@@ -87,9 +87,9 @@ test_expect_success 'push mirror removes branches' '
87
88
mk_repo_pair &&
89
(
90
- cd master &&
90
+ cd main &&
91
echo one >foo && git add foo && git commit -m one &&
92
- git branch remove master &&
92
+ git branch remove main &&
93
git push --mirror up &&
94
git branch -D remove &&
95
git push --mirror up
@@ -105,21 +105,21 @@ test_expect_success 'push mirror adds, updates and removes branches together' '
105
106
mk_repo_pair &&
107
(
108
- cd master &&
108
+ cd main &&
109
echo one >foo && git add foo && git commit -m one &&
110
- git branch remove master &&
110
+ git branch remove main &&
111
git push --mirror up &&
112
git branch -D remove &&
113
- git branch add master &&
113
+ git branch add main &&
114
echo two >foo && git add foo && git commit -m two &&
115
git push --mirror up
116
) &&
117
- master_master=$(cd master && git show-ref -s --verify refs/heads/master) &&
118
- master_add=$(cd master && git show-ref -s --verify refs/heads/add) &&
119
- mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) &&
117
+ main_main=$(cd main && git show-ref -s --verify refs/heads/main) &&
118
+ main_add=$(cd main && git show-ref -s --verify refs/heads/add) &&
119
+ mirror_main=$(cd mirror && git show-ref -s --verify refs/heads/main) &&
120
mirror_add=$(cd mirror && git show-ref -s --verify refs/heads/add) &&
121
- test "$master_master" = "$mirror_master" &&
122
- test "$master_add" = "$mirror_add" &&
121
+ test "$main_main" = "$mirror_main" &&
122
+ test "$main_add" = "$mirror_add" &&
123
(
124
cd mirror &&
125
invert git show-ref -s --verify refs/heads/remove
@@ -133,14 +133,14 @@ test_expect_success 'push mirror creates new tags' '
133
134
mk_repo_pair &&
135
(
136
- cd master &&
136
+ cd main &&
137
echo one >foo && git add foo && git commit -m one &&
138
- git tag -f tmaster master &&
138
+ git tag -f tmain main &&
139
git push --mirror up
140
) &&
141
- master_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) &&
142
- mirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) &&
143
- test "$master_master" = "$mirror_master"
141
+ main_main=$(cd main && git show-ref -s --verify refs/tags/tmain) &&
142
+ mirror_main=$(cd mirror && git show-ref -s --verify refs/tags/tmain) &&
143
+ test "$main_main" = "$mirror_main"
144
145
'
146
@@ -148,17 +148,17 @@ test_expect_success 'push mirror updates existing tags' '
148
149
mk_repo_pair &&
150
(
151
- cd master &&
151
+ cd main &&
152
echo one >foo && git add foo && git commit -m one &&
153
- git tag -f tmaster master &&
153
+ git tag -f tmain main &&
154
git push --mirror up &&
155
echo two >foo && git add foo && git commit -m two &&
156
- git tag -f tmaster master &&
156
+ git tag -f tmain main &&
157
git push --mirror up
158
) &&
159
- master_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) &&
160
- mirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) &&
161
- test "$master_master" = "$mirror_master"
159
+ main_main=$(cd main && git show-ref -s --verify refs/tags/tmain) &&
160
+ mirror_main=$(cd mirror && git show-ref -s --verify refs/tags/tmain) &&
161
+ test "$main_main" = "$mirror_main"
162
163
'
164
@@ -166,20 +166,20 @@ test_expect_success 'push mirror force updates existing tags' '
166
167
mk_repo_pair &&
168
(
169
- cd master &&
169
+ cd main &&
170
echo one >foo && git add foo && git commit -m one &&
171
- git tag -f tmaster master &&
171
+ git tag -f tmain main &&
172
git push --mirror up &&
173
echo two >foo && git add foo && git commit -m two &&
174
- git tag -f tmaster master &&
174
+ git tag -f tmain main &&
175
git push --mirror up &&
176
git reset --hard HEAD^ &&
177
- git tag -f tmaster master &&
177
+ git tag -f tmain main &&
178
git push --mirror up
179
) &&
180
- master_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) &&
181
- mirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) &&
182
- test "$master_master" = "$mirror_master"
180
+ main_main=$(cd main && git show-ref -s --verify refs/tags/tmain) &&
181
+ mirror_main=$(cd mirror && git show-ref -s --verify refs/tags/tmain) &&
182
+ test "$main_main" = "$mirror_main"
183
184
'
185
@@ -187,9 +187,9 @@ test_expect_success 'push mirror removes tags' '
187
188
mk_repo_pair &&
189
(
190
- cd master &&
190
+ cd main &&
191
echo one >foo && git add foo && git commit -m one &&
192
- git tag -f tremove master &&
192
+ git tag -f tremove main &&
193
git push --mirror up &&
194
git tag -d tremove &&
195
git push --mirror up
@@ -205,23 +205,23 @@ test_expect_success 'push mirror adds, updates and removes tags together' '
205
206
mk_repo_pair &&
207
(
208
- cd master &&
208
+ cd main &&
209
echo one >foo && git add foo && git commit -m one &&
210
- git tag -f tmaster master &&
211
- git tag -f tremove master &&
210
+ git tag -f tmain main &&
211
+ git tag -f tremove main &&
212
git push --mirror up &&
213
git tag -d tremove &&
214
- git tag tadd master &&
214
+ git tag tadd main &&
215
echo two >foo && git add foo && git commit -m two &&
216
- git tag -f tmaster master &&
216
+ git tag -f tmain main &&
217
git push --mirror up
218
) &&
219
- master_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) &&
220
- master_add=$(cd master && git show-ref -s --verify refs/tags/tadd) &&
221
- mirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) &&
219
+ main_main=$(cd main && git show-ref -s --verify refs/tags/tmain) &&
220
+ main_add=$(cd main && git show-ref -s --verify refs/tags/tadd) &&
221
+ mirror_main=$(cd mirror && git show-ref -s --verify refs/tags/tmain) &&
222
mirror_add=$(cd mirror && git show-ref -s --verify refs/tags/tadd) &&
223
- test "$master_master" = "$mirror_master" &&
224
- test "$master_add" = "$mirror_add" &&
223
+ test "$main_main" = "$mirror_main" &&
224
+ test "$main_add" = "$mirror_add" &&
225
(
226
cd mirror &&
227
invert git show-ref -s --verify refs/tags/tremove
@@ -233,10 +233,10 @@ test_expect_success 'remote.foo.mirror adds and removes branches' '
233
234
mk_repo_pair --mirror &&
235
(
236
- cd master &&
236
+ cd main &&
237
echo one >foo && git add foo && git commit -m one &&
238
- git branch keep master &&
239
- git branch remove master &&
238
+ git branch keep main &&
239
+ git branch remove main &&
240
git push up &&
241
git branch -D remove &&
242
git push up
@@ -253,10 +253,10 @@ test_expect_success 'remote.foo.mirror=no has no effect' '
253
254
mk_repo_pair &&
255
(
256
- cd master &&
256
+ cd main &&
257
echo one >foo && git add foo && git commit -m one &&
258
git config --add remote.up.mirror no &&
259
- git branch keep master &&
259
+ git branch keep main &&
260
git push --mirror up &&
261
git branch -D keep &&
262
git push up :
@@ -271,10 +271,10 @@ test_expect_success 'remote.foo.mirror=no has no effect' '
271
test_expect_success 'push to mirrored repository with refspec fails' '
272
mk_repo_pair &&
273
(
274
- cd master &&
274
+ cd main &&
275
echo one >foo && git add foo && git commit -m one &&
276
git config --add remote.up.mirror true &&
277
- test_must_fail git push up master
277
+ test_must_fail git push up main
278
)
279
'
280
t/t5518-fetch-exit-status.sh
+4
-4
@@ -5,7 +5,7 @@
5
6
test_description='fetch exit status test'
7
8
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
8
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
9
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10
11
. ./test-lib.sh
@@ -20,20 +20,20 @@ test_expect_success setup '
20
echo side >file &&
21
git commit -a -m side &&
22
23
- git checkout master &&
23
+ git checkout main &&
24
echo next >file &&
25
git commit -a -m next
26
'
27
28
test_expect_success 'non-fast-forward fetch' '
29
30
- test_must_fail git fetch . master:side
30
+ test_must_fail git fetch . main:side
31
32
'
33
34
test_expect_success 'forced update' '
35
36
- git fetch . +master:side
36
+ git fetch . +main:side
37
38
'
39
t/t5519-push-alternates.sh
+7
-7
@@ -2,7 +2,7 @@
2
3
test_description='push to a repository that borrows from elsewhere'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -20,7 +20,7 @@ test_expect_success setup '
20
>file &&
21
git add . &&
22
git commit -m initial &&
23
- git push ../alice-pub master
23
+ git push ../alice-pub main
24
) &&
25
26
# Project Bob is a fork of project Alice
@@ -34,7 +34,7 @@ test_expect_success setup '
34
git clone alice-pub bob-work &&
35
(
36
cd bob-work &&
37
- git push ../bob-pub master
37
+ git push ../bob-pub main
38
)
39
'
40
@@ -57,7 +57,7 @@ test_expect_success 'bob fetches from alice, works and pushes' '
57
# has at her public repository are available to it
58
# via its alternates.
59
cd bob-work &&
60
- git pull ../alice-pub master &&
60
+ git pull ../alice-pub main &&
61
echo more bob >file &&
62
git commit -a -m third &&
63
git push ../bob-pub :
@@ -96,7 +96,7 @@ test_expect_success 'alice works and pushes again' '
96
test_expect_success 'bob works and pushes' '
97
(
98
# This time Bob does not pull from Alice, and
99
- # the master branch at her public repository points
99
+ # the main branch at her public repository points
100
# at a commit Bob does not know about. This should
101
# not prevent the push by Bob from succeeding.
102
cd bob-work &&
@@ -125,11 +125,11 @@ test_expect_success 'alice works and pushes yet again' '
125
test_expect_success 'bob works and pushes again' '
126
(
127
cd alice-pub &&
128
- git cat-file commit master >../bob-work/commit
128
+ git cat-file commit main >../bob-work/commit
129
) &&
130
(
131
# This time Bob does not pull from Alice, and
132
- # the master branch at her public repository points
132
+ # the main branch at her public repository points
133
# at a commit Bob does not fully know about, but
134
# he happens to have the commit object (but not the
135
# necessary tree) in his repository from Alice.