@@ -38,20 +38,21 @@ write_command () {
3838
3939# c(o/foo) d(o/bar)
4040# \ /
41- # b e(baz) f(master )
41+ # b e(baz) f(main )
4242# \__ | __/
4343# \ | /
4444# a
4545test_expect_success ' setup repository' '
4646 test_commit a &&
47+ git branch -M main &&
4748 git checkout -b o/foo &&
4849 test_commit b &&
4950 test_commit c &&
5051 git checkout -b o/bar b &&
5152 test_commit d &&
5253 git checkout -b baz a &&
5354 test_commit e &&
54- git checkout master &&
55+ git checkout main &&
5556 test_commit f
5657'
5758
@@ -88,7 +89,7 @@ test_expect_success 'invalid want-ref line' '
8889test_expect_success ' basic want-ref' '
8990 oid=$(git rev-parse f) &&
9091 cat >expected_refs <<-EOF &&
91- $oid refs/heads/master
92+ $oid refs/heads/main
9293 EOF
9394 git rev-parse f >expected_commits &&
9495
@@ -97,7 +98,7 @@ test_expect_success 'basic want-ref' '
9798 $(write_command fetch)
9899 0001
99100 no-progress
100- want-ref refs/heads/master
101+ want-ref refs/heads/main
101102 have $oid
102103 done
103104 0000
@@ -135,15 +136,15 @@ test_expect_success 'multiple want-ref lines' '
135136test_expect_success ' mix want and want-ref' '
136137 oid=$(git rev-parse f) &&
137138 cat >expected_refs <<-EOF &&
138- $oid refs/heads/master
139+ $oid refs/heads/main
139140 EOF
140141 git rev-parse e f >expected_commits &&
141142
142143 test-tool pkt-line pack >in <<-EOF &&
143144 $(write_command fetch)
144145 0001
145146 no-progress
146- want-ref refs/heads/master
147+ want-ref refs/heads/main
147148 want $(git rev-parse e)
148149 have $(git rev-parse a)
149150 done
@@ -182,7 +183,7 @@ LOCAL_PRISTINE="$(pwd)/local_pristine"
182183# $REPO
183184# c(o/foo) d(o/bar)
184185# \ /
185- # b e(baz) f(master )
186+ # b e(baz) f(main )
186187# \__ | __/
187188# \ | /
188189# a
@@ -193,10 +194,10 @@ LOCAL_PRISTINE="$(pwd)/local_pristine"
193194# .
194195# .
195196# |
196- # a(master )
197+ # a(main )
197198test_expect_success ' setup repos for fetching with ref-in-want tests' '
198199 (
199- git init "$REPO" &&
200+ git init -b main "$REPO" &&
200201 cd "$REPO" &&
201202 test_commit a &&
202203
@@ -209,7 +210,7 @@ test_expect_success 'setup repos for fetching with ref-in-want tests' '
209210 test_commit_bulk --id=s 33 &&
210211
211212 # Add novel commits to upstream
212- git checkout master &&
213+ git checkout main &&
213214 cd "$REPO" &&
214215 git checkout -b o/foo &&
215216 test_commit b &&
@@ -218,7 +219,7 @@ test_expect_success 'setup repos for fetching with ref-in-want tests' '
218219 test_commit d &&
219220 git checkout -b baz a &&
220221 test_commit e &&
221- git checkout master &&
222+ git checkout main &&
222223 test_commit f
223224 ) &&
224225 git -C "$REPO" config uploadpack.allowRefInWant true &&
@@ -245,12 +246,12 @@ test_expect_success 'fetching multiple refs' '
245246
246247 rm -rf local &&
247248 cp -r "$LOCAL_PRISTINE" local &&
248- GIT_TRACE_PACKET="$(pwd)/log" git -C local fetch origin master baz &&
249+ GIT_TRACE_PACKET="$(pwd)/log" git -C local fetch origin main baz &&
249250
250- git -C "$REPO" rev-parse "master " "baz" >expected &&
251- git -C local rev-parse refs/remotes/origin/master refs/remotes/origin/baz >actual &&
251+ git -C "$REPO" rev-parse "main " "baz" >expected &&
252+ git -C local rev-parse refs/remotes/origin/main refs/remotes/origin/baz >actual &&
252253 test_cmp expected actual &&
253- grep "want-ref refs/heads/master " log &&
254+ grep "want-ref refs/heads/main " log &&
254255 grep "want-ref refs/heads/baz" log
255256'
256257
@@ -261,13 +262,13 @@ test_expect_success 'fetching ref and exact OID' '
261262 cp -r "$LOCAL_PRISTINE" local &&
262263 oid=$(git -C "$REPO" rev-parse b) &&
263264 GIT_TRACE_PACKET="$(pwd)/log" git -C local fetch origin \
264- master "$oid":refs/heads/actual &&
265+ main "$oid":refs/heads/actual &&
265266
266- git -C "$REPO" rev-parse "master " "b" >expected &&
267- git -C local rev-parse refs/remotes/origin/master refs/heads/actual >actual &&
267+ git -C "$REPO" rev-parse "main " "b" >expected &&
268+ git -C local rev-parse refs/remotes/origin/main refs/heads/actual >actual &&
268269 test_cmp expected actual &&
269270 grep "want $oid" log &&
270- grep "want-ref refs/heads/master " log
271+ grep "want-ref refs/heads/main " log
271272'
272273
273274test_expect_success ' fetching with wildcard that does not match any refs' '
@@ -301,7 +302,7 @@ LOCAL_PRISTINE="$(pwd)/local_pristine"
301302
302303test_expect_success ' setup repos for change-while-negotiating test' '
303304 (
304- git init "$REPO" &&
305+ git init -b main "$REPO" &&
305306 cd "$REPO" &&
306307 >.git/git-daemon-export-ok &&
307308 test_commit m1 &&
@@ -316,7 +317,7 @@ test_expect_success 'setup repos for change-while-negotiating test' '
316317 test_commit_bulk --id=s 33 &&
317318
318319 # Add novel commits to upstream
319- git checkout master &&
320+ git checkout main &&
320321 cd "$REPO" &&
321322 test_commit m2 &&
322323 test_commit m3 &&
@@ -342,7 +343,7 @@ test_expect_success 'server is initially ahead - no ref in want' '
342343 git -C "$REPO" config uploadpack.allowRefInWant false &&
343344 rm -rf local &&
344345 cp -r "$LOCAL_PRISTINE" local &&
345- inconsistency master $(test_oid numeric) &&
346+ inconsistency main $(test_oid numeric) &&
346347 test_must_fail git -C local fetch 2>err &&
347348 test_i18ngrep "fatal: remote error: upload-pack: not our ref" err
348349'
@@ -351,39 +352,39 @@ test_expect_success 'server is initially ahead - ref in want' '
351352 git -C "$REPO" config uploadpack.allowRefInWant true &&
352353 rm -rf local &&
353354 cp -r "$LOCAL_PRISTINE" local &&
354- inconsistency master $(test_oid numeric) &&
355+ inconsistency main $(test_oid numeric) &&
355356 git -C local fetch &&
356357
357- git -C "$REPO" rev-parse --verify master >expected &&
358- git -C local rev-parse --verify refs/remotes/origin/master >actual &&
358+ git -C "$REPO" rev-parse --verify main >expected &&
359+ git -C local rev-parse --verify refs/remotes/origin/main >actual &&
359360 test_cmp expected actual
360361'
361362
362363test_expect_success ' server is initially behind - no ref in want' '
363364 git -C "$REPO" config uploadpack.allowRefInWant false &&
364365 rm -rf local &&
365366 cp -r "$LOCAL_PRISTINE" local &&
366- inconsistency master "master ^" &&
367+ inconsistency main "main ^" &&
367368 git -C local fetch &&
368369
369- git -C "$REPO" rev-parse --verify "master ^" >expected &&
370- git -C local rev-parse --verify refs/remotes/origin/master >actual &&
370+ git -C "$REPO" rev-parse --verify "main ^" >expected &&
371+ git -C local rev-parse --verify refs/remotes/origin/main >actual &&
371372 test_cmp expected actual
372373'
373374
374375test_expect_success ' server is initially behind - ref in want' '
375376 git -C "$REPO" config uploadpack.allowRefInWant true &&
376377 rm -rf local &&
377378 cp -r "$LOCAL_PRISTINE" local &&
378- inconsistency master "master ^" &&
379+ inconsistency main "main ^" &&
379380 git -C local fetch &&
380381
381- git -C "$REPO" rev-parse --verify "master " >expected &&
382- git -C local rev-parse --verify refs/remotes/origin/master >actual &&
382+ git -C "$REPO" rev-parse --verify "main " >expected &&
383+ git -C local rev-parse --verify refs/remotes/origin/main >actual &&
383384 test_cmp expected actual
384385'
385386
386- test_expect_success PREPARE_FOR_MAIN_BRANCH ' server loses a ref - ref in want' '
387+ test_expect_success ' server loses a ref - ref in want' '
387388 git -C "$REPO" config uploadpack.allowRefInWant true &&
388389 rm -rf local &&
389390 cp -r "$LOCAL_PRISTINE" local &&
0 commit comments