t5703: use `main` as initial branch name
In 97cf8d50b59 (t5703: adjust a test case for the upcoming default branch name, 2020-10-23), we prepared this test script for a world when the default initial branch name would be `main`. However, there is no need to wait for that: let's adjust the test script to stop relying on a specific initial branch name by setting it explicitly. This allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq from one test case. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Dec 17, 2020 at 01:07 UTC
72dc172804fc26a8be5b2805bb47c8773635d558
1 file changed
+33
-32
t/t5703-upload-pack-ref-in-want.sh
+33
-32
@@ -38,12 +38,13 @@ write_command () {
38
39
# c(o/foo) d(o/bar)
40
# \ /
41
-# b e(baz) f(master)
41
+# b e(baz) f(main)
42
# \__ | __/
43
# \ | /
44
# a
45
test_expect_success 'setup repository' '
46
test_commit a &&
47
+ git branch -M main &&
48
git checkout -b o/foo &&
49
test_commit b &&
50
test_commit c &&
@@ -51,7 +52,7 @@ test_expect_success 'setup repository' '
52
test_commit d &&
53
git checkout -b baz a &&
54
test_commit e &&
54
- git checkout master &&
55
+ git checkout main &&
56
test_commit f
57
'
58
@@ -88,7 +89,7 @@ test_expect_success 'invalid want-ref line' '
89
test_expect_success 'basic want-ref' '
90
oid=$(git rev-parse f) &&
91
cat >expected_refs <<-EOF &&
91
- $oid refs/heads/master
92
+ $oid refs/heads/main
93
EOF
94
git rev-parse f >expected_commits &&
95
@@ -97,7 +98,7 @@ test_expect_success 'basic want-ref' '
98
$(write_command fetch)
99
0001
100
no-progress
100
- want-ref refs/heads/master
101
+ want-ref refs/heads/main
102
have $oid
103
done
104
0000
@@ -135,7 +136,7 @@ test_expect_success 'multiple want-ref lines' '
136
test_expect_success 'mix want and want-ref' '
137
oid=$(git rev-parse f) &&
138
cat >expected_refs <<-EOF &&
138
- $oid refs/heads/master
139
+ $oid refs/heads/main
140
EOF
141
git rev-parse e f >expected_commits &&
142
@@ -143,7 +144,7 @@ test_expect_success 'mix want and want-ref' '
144
$(write_command fetch)
145
0001
146
no-progress
146
- want-ref refs/heads/master
147
+ want-ref refs/heads/main
148
want $(git rev-parse e)
149
have $(git rev-parse a)
150
done
@@ -182,7 +183,7 @@ LOCAL_PRISTINE="$(pwd)/local_pristine"
183
# $REPO
184
# c(o/foo) d(o/bar)
185
# \ /
185
-# b e(baz) f(master)
186
+# b e(baz) f(main)
187
# \__ | __/
188
# \ | /
189
# a
@@ -193,10 +194,10 @@ LOCAL_PRISTINE="$(pwd)/local_pristine"
194
# .
195
# .
196
# |
196
-# a(master)
197
+# a(main)
198
test_expect_success 'setup repos for fetching with ref-in-want tests' '
199
(
199
- git init "$REPO" &&
200
+ git init -b main "$REPO" &&
201
cd "$REPO" &&
202
test_commit a &&
203
@@ -209,7 +210,7 @@ test_expect_success 'setup repos for fetching with ref-in-want tests' '
210
test_commit_bulk --id=s 33 &&
211
212
# Add novel commits to upstream
212
- git checkout master &&
213
+ git checkout main &&
214
cd "$REPO" &&
215
git checkout -b o/foo &&
216
test_commit b &&
@@ -218,7 +219,7 @@ test_expect_success 'setup repos for fetching with ref-in-want tests' '
219
test_commit d &&
220
git checkout -b baz a &&
221
test_commit e &&
221
- git checkout master &&
222
+ git checkout main &&
223
test_commit f
224
) &&
225
git -C "$REPO" config uploadpack.allowRefInWant true &&
@@ -245,12 +246,12 @@ test_expect_success 'fetching multiple refs' '
246
247
rm -rf local &&
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 &&
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 &&
253
test_cmp expected actual &&
253
- grep "want-ref refs/heads/master" log &&
254
+ grep "want-ref refs/heads/main" log &&
255
grep "want-ref refs/heads/baz" log
256
'
257
@@ -261,13 +262,13 @@ test_expect_success 'fetching ref and exact OID' '
262
cp -r "$LOCAL_PRISTINE" local &&
263
oid=$(git -C "$REPO" rev-parse b) &&
264
GIT_TRACE_PACKET="$(pwd)/log" git -C local fetch origin \
264
- master "$oid":refs/heads/actual &&
265
+ main "$oid":refs/heads/actual &&
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 &&
269
test_cmp expected actual &&
270
grep "want $oid" log &&
270
- grep "want-ref refs/heads/master" log
271
+ grep "want-ref refs/heads/main" log
272
'
273
274
test_expect_success 'fetching with wildcard that does not match any refs' '
@@ -301,7 +302,7 @@ LOCAL_PRISTINE="$(pwd)/local_pristine"
302
303
test_expect_success 'setup repos for change-while-negotiating test' '
304
(
304
- git init "$REPO" &&
305
+ git init -b main "$REPO" &&
306
cd "$REPO" &&
307
>.git/git-daemon-export-ok &&
308
test_commit m1 &&
@@ -316,7 +317,7 @@ test_expect_success 'setup repos for change-while-negotiating test' '
317
test_commit_bulk --id=s 33 &&
318
319
# Add novel commits to upstream
319
- git checkout master &&
320
+ git checkout main &&
321
cd "$REPO" &&
322
test_commit m2 &&
323
test_commit m3 &&
@@ -342,7 +343,7 @@ test_expect_success 'server is initially ahead - no ref in want' '
343
git -C "$REPO" config uploadpack.allowRefInWant false &&
344
rm -rf local &&
345
cp -r "$LOCAL_PRISTINE" local &&
345
- inconsistency master $(test_oid numeric) &&
346
+ inconsistency main $(test_oid numeric) &&
347
test_must_fail git -C local fetch 2>err &&
348
test_i18ngrep "fatal: remote error: upload-pack: not our ref" err
349
'
@@ -351,11 +352,11 @@ test_expect_success 'server is initially ahead - ref in want' '
352
git -C "$REPO" config uploadpack.allowRefInWant true &&
353
rm -rf local &&
354
cp -r "$LOCAL_PRISTINE" local &&
354
- inconsistency master $(test_oid numeric) &&
355
+ inconsistency main $(test_oid numeric) &&
356
git -C local fetch &&
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 &&
360
test_cmp expected actual
361
'
362
@@ -363,11 +364,11 @@ test_expect_success 'server is initially behind - no ref in want' '
364
git -C "$REPO" config uploadpack.allowRefInWant false &&
365
rm -rf local &&
366
cp -r "$LOCAL_PRISTINE" local &&
366
- inconsistency master "master^" &&
367
+ inconsistency main "main^" &&
368
git -C local fetch &&
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 &&
372
test_cmp expected actual
373
'
374
@@ -375,15 +376,15 @@ test_expect_success 'server is initially behind - ref in want' '
376
git -C "$REPO" config uploadpack.allowRefInWant true &&
377
rm -rf local &&
378
cp -r "$LOCAL_PRISTINE" local &&
378
- inconsistency master "master^" &&
379
+ inconsistency main "main^" &&
380
git -C local fetch &&
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 &&
384
test_cmp expected actual
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' '
388
git -C "$REPO" config uploadpack.allowRefInWant true &&
389
rm -rf local &&
390
cp -r "$LOCAL_PRISTINE" local &&