@@ -38,20 +38,21 @@ write_command () {
38
38
39
39
# c(o/foo) d(o/bar)
40
40
# \ /
41
- # b e(baz) f(master )
41
+ # b e(baz) f(main )
42
42
# \__ | __/
43
43
# \ | /
44
44
# a
45
45
test_expect_success ' setup repository' '
46
46
test_commit a &&
47
+ git branch -M main &&
47
48
git checkout -b o/foo &&
48
49
test_commit b &&
49
50
test_commit c &&
50
51
git checkout -b o/bar b &&
51
52
test_commit d &&
52
53
git checkout -b baz a &&
53
54
test_commit e &&
54
- git checkout master &&
55
+ git checkout main &&
55
56
test_commit f
56
57
'
57
58
@@ -88,7 +89,7 @@ test_expect_success 'invalid want-ref line' '
88
89
test_expect_success ' basic want-ref' '
89
90
oid=$(git rev-parse f) &&
90
91
cat >expected_refs <<-EOF &&
91
- $oid refs/heads/master
92
+ $oid refs/heads/main
92
93
EOF
93
94
git rev-parse f >expected_commits &&
94
95
@@ -97,7 +98,7 @@ test_expect_success 'basic want-ref' '
97
98
$(write_command fetch)
98
99
0001
99
100
no-progress
100
- want-ref refs/heads/master
101
+ want-ref refs/heads/main
101
102
have $oid
102
103
done
103
104
0000
@@ -135,15 +136,15 @@ test_expect_success 'multiple want-ref lines' '
135
136
test_expect_success ' mix want and want-ref' '
136
137
oid=$(git rev-parse f) &&
137
138
cat >expected_refs <<-EOF &&
138
- $oid refs/heads/master
139
+ $oid refs/heads/main
139
140
EOF
140
141
git rev-parse e f >expected_commits &&
141
142
142
143
test-tool pkt-line pack >in <<-EOF &&
143
144
$(write_command fetch)
144
145
0001
145
146
no-progress
146
- want-ref refs/heads/master
147
+ want-ref refs/heads/main
147
148
want $(git rev-parse e)
148
149
have $(git rev-parse a)
149
150
done
@@ -182,7 +183,7 @@ LOCAL_PRISTINE="$(pwd)/local_pristine"
182
183
# $REPO
183
184
# c(o/foo) d(o/bar)
184
185
# \ /
185
- # b e(baz) f(master )
186
+ # b e(baz) f(main )
186
187
# \__ | __/
187
188
# \ | /
188
189
# a
@@ -193,10 +194,10 @@ LOCAL_PRISTINE="$(pwd)/local_pristine"
193
194
# .
194
195
# .
195
196
# |
196
- # a(master )
197
+ # a(main )
197
198
test_expect_success ' setup repos for fetching with ref-in-want tests' '
198
199
(
199
- git init "$REPO" &&
200
+ git init -b main "$REPO" &&
200
201
cd "$REPO" &&
201
202
test_commit a &&
202
203
@@ -209,7 +210,7 @@ test_expect_success 'setup repos for fetching with ref-in-want tests' '
209
210
test_commit_bulk --id=s 33 &&
210
211
211
212
# Add novel commits to upstream
212
- git checkout master &&
213
+ git checkout main &&
213
214
cd "$REPO" &&
214
215
git checkout -b o/foo &&
215
216
test_commit b &&
@@ -218,7 +219,7 @@ test_expect_success 'setup repos for fetching with ref-in-want tests' '
218
219
test_commit d &&
219
220
git checkout -b baz a &&
220
221
test_commit e &&
221
- git checkout master &&
222
+ git checkout main &&
222
223
test_commit f
223
224
) &&
224
225
git -C "$REPO" config uploadpack.allowRefInWant true &&
@@ -245,12 +246,12 @@ test_expect_success 'fetching multiple refs' '
245
246
246
247
rm -rf local &&
247
248
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 &&
249
250
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 &&
252
253
test_cmp expected actual &&
253
- grep "want-ref refs/heads/master " log &&
254
+ grep "want-ref refs/heads/main " log &&
254
255
grep "want-ref refs/heads/baz" log
255
256
'
256
257
@@ -261,13 +262,13 @@ test_expect_success 'fetching ref and exact OID' '
261
262
cp -r "$LOCAL_PRISTINE" local &&
262
263
oid=$(git -C "$REPO" rev-parse b) &&
263
264
GIT_TRACE_PACKET="$(pwd)/log" git -C local fetch origin \
264
- master "$oid":refs/heads/actual &&
265
+ main "$oid":refs/heads/actual &&
265
266
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 &&
268
269
test_cmp expected actual &&
269
270
grep "want $oid" log &&
270
- grep "want-ref refs/heads/master " log
271
+ grep "want-ref refs/heads/main " log
271
272
'
272
273
273
274
test_expect_success ' fetching with wildcard that does not match any refs' '
@@ -301,7 +302,7 @@ LOCAL_PRISTINE="$(pwd)/local_pristine"
301
302
302
303
test_expect_success ' setup repos for change-while-negotiating test' '
303
304
(
304
- git init "$REPO" &&
305
+ git init -b main "$REPO" &&
305
306
cd "$REPO" &&
306
307
>.git/git-daemon-export-ok &&
307
308
test_commit m1 &&
@@ -316,7 +317,7 @@ test_expect_success 'setup repos for change-while-negotiating test' '
316
317
test_commit_bulk --id=s 33 &&
317
318
318
319
# Add novel commits to upstream
319
- git checkout master &&
320
+ git checkout main &&
320
321
cd "$REPO" &&
321
322
test_commit m2 &&
322
323
test_commit m3 &&
@@ -342,7 +343,7 @@ test_expect_success 'server is initially ahead - no ref in want' '
342
343
git -C "$REPO" config uploadpack.allowRefInWant false &&
343
344
rm -rf local &&
344
345
cp -r "$LOCAL_PRISTINE" local &&
345
- inconsistency master $(test_oid numeric) &&
346
+ inconsistency main $(test_oid numeric) &&
346
347
test_must_fail git -C local fetch 2>err &&
347
348
test_i18ngrep "fatal: remote error: upload-pack: not our ref" err
348
349
'
@@ -351,39 +352,39 @@ test_expect_success 'server is initially ahead - ref in want' '
351
352
git -C "$REPO" config uploadpack.allowRefInWant true &&
352
353
rm -rf local &&
353
354
cp -r "$LOCAL_PRISTINE" local &&
354
- inconsistency master $(test_oid numeric) &&
355
+ inconsistency main $(test_oid numeric) &&
355
356
git -C local fetch &&
356
357
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 &&
359
360
test_cmp expected actual
360
361
'
361
362
362
363
test_expect_success ' server is initially behind - no ref in want' '
363
364
git -C "$REPO" config uploadpack.allowRefInWant false &&
364
365
rm -rf local &&
365
366
cp -r "$LOCAL_PRISTINE" local &&
366
- inconsistency master "master ^" &&
367
+ inconsistency main "main ^" &&
367
368
git -C local fetch &&
368
369
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 &&
371
372
test_cmp expected actual
372
373
'
373
374
374
375
test_expect_success ' server is initially behind - ref in want' '
375
376
git -C "$REPO" config uploadpack.allowRefInWant true &&
376
377
rm -rf local &&
377
378
cp -r "$LOCAL_PRISTINE" local &&
378
- inconsistency master "master ^" &&
379
+ inconsistency main "main ^" &&
379
380
git -C local fetch &&
380
381
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 &&
383
384
test_cmp expected actual
384
385
'
385
386
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' '
387
388
git -C "$REPO" config uploadpack.allowRefInWant true &&
388
389
rm -rf local &&
389
390
cp -r "$LOCAL_PRISTINE" local &&
0 commit comments