t1400: use `main` as initial branch name
In 3224b0f0bb7 (t1400: prepare for `main` being default branch name, 2020-10-23), we prepared t1400 for a time when the default initial branch name would be `main`. However, there is no need to wait that long: 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 two test cases. 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
35a16dbe329ae5e04ea7005c2220f0e82d8f8c3a
1 file changed
+38
-37
t/t1400-update-ref.sh
+38
-37
@@ -8,7 +8,7 @@ test_description='Test git update-ref and basic ref logging'
8
9
Z=$ZERO_OID
10
11
-m=refs/heads/master
11
+m=refs/heads/main
12
n_dir=refs/heads/gu
13
n=$n_dir/fixes
14
outside=refs/foo
@@ -27,10 +27,11 @@ create_test_commits ()
27
}
28
29
test_expect_success setup '
30
+ git checkout --orphan main &&
31
create_test_commits "" &&
32
mkdir $bare &&
33
cd $bare &&
33
- git init --bare &&
34
+ git init --bare -b main &&
35
create_test_commits "bare" &&
36
cd -
37
'
@@ -264,7 +265,7 @@ test_expect_success "(not) changed .git/$m" '
265
! test $B = $(git show-ref -s --verify $m)
266
'
267
267
-rm -f .git/logs/refs/heads/master
268
+rm -f .git/logs/refs/heads/main
269
test_expect_success "create $m (logged by touch)" '
270
test_config core.logAllRefUpdates false &&
271
GIT_COMMITTER_DATE="2005-05-26 23:30" \
@@ -300,7 +301,7 @@ test_expect_success 'symref empty directory removal' '
301
git branch e1/e2/r1 HEAD &&
302
git branch e1/r2 HEAD &&
303
git checkout e1/e2/r1 &&
303
- test_when_finished "git checkout master" &&
304
+ test_when_finished "git checkout main" &&
305
test_path_is_file .git/refs/heads/e1/e2/r1 &&
306
test_path_is_file .git/logs/refs/heads/e1/e2/r1 &&
307
git update-ref -d HEAD &&
@@ -364,68 +365,68 @@ test_expect_success 'set up for querying the reflog' '
365
ed="Thu, 26 May 2005 18:32:00 -0500"
366
gd="Thu, 26 May 2005 18:33:00 -0500"
367
ld="Thu, 26 May 2005 18:43:00 -0500"
367
-test_expect_success 'Query "master@{May 25 2005}" (before history)' '
368
+test_expect_success 'Query "main@{May 25 2005}" (before history)' '
369
test_when_finished "rm -f o e" &&
369
- git rev-parse --verify "master@{May 25 2005}" >o 2>e &&
370
+ git rev-parse --verify "main@{May 25 2005}" >o 2>e &&
371
echo "$C" >expect &&
372
test_cmp expect o &&
372
- echo "warning: log for '\''master'\'' only goes back to $ed" >expect &&
373
+ echo "warning: log for '\''main'\'' only goes back to $ed" >expect &&
374
test_i18ncmp expect e
375
'
375
-test_expect_success 'Query master@{2005-05-25} (before history)' '
376
+test_expect_success 'Query main@{2005-05-25} (before history)' '
377
test_when_finished "rm -f o e" &&
377
- git rev-parse --verify master@{2005-05-25} >o 2>e &&
378
+ git rev-parse --verify main@{2005-05-25} >o 2>e &&
379
echo "$C" >expect &&
380
test_cmp expect o &&
380
- echo "warning: log for '\''master'\'' only goes back to $ed" >expect &&
381
+ echo "warning: log for '\''main'\'' only goes back to $ed" >expect &&
382
test_i18ncmp expect e
383
'
383
-test_expect_success 'Query "master@{May 26 2005 23:31:59}" (1 second before history)' '
384
+test_expect_success 'Query "main@{May 26 2005 23:31:59}" (1 second before history)' '
385
test_when_finished "rm -f o e" &&
385
- git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e &&
386
+ git rev-parse --verify "main@{May 26 2005 23:31:59}" >o 2>e &&
387
echo "$C" >expect &&
388
test_cmp expect o &&
388
- echo "warning: log for '\''master'\'' only goes back to $ed" >expect &&
389
+ echo "warning: log for '\''main'\'' only goes back to $ed" >expect &&
390
test_i18ncmp expect e
391
'
391
-test_expect_success 'Query "master@{May 26 2005 23:32:00}" (exactly history start)' '
392
+test_expect_success 'Query "main@{May 26 2005 23:32:00}" (exactly history start)' '
393
test_when_finished "rm -f o e" &&
393
- git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
394
+ git rev-parse --verify "main@{May 26 2005 23:32:00}" >o 2>e &&
395
echo "$C" >expect &&
396
test_cmp expect o &&
397
test_must_be_empty e
398
'
398
-test_expect_success 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' '
399
+test_expect_success 'Query "main@{May 26 2005 23:32:30}" (first non-creation change)' '
400
test_when_finished "rm -f o e" &&
400
- git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e &&
401
+ git rev-parse --verify "main@{May 26 2005 23:32:30}" >o 2>e &&
402
echo "$A" >expect &&
403
test_cmp expect o &&
404
test_must_be_empty e
405
'
405
-test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' '
406
+test_expect_success 'Query "main@{2005-05-26 23:33:01}" (middle of history with gap)' '
407
test_when_finished "rm -f o e" &&
407
- git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e &&
408
+ git rev-parse --verify "main@{2005-05-26 23:33:01}" >o 2>e &&
409
echo "$B" >expect &&
410
test_cmp expect o &&
411
test_i18ngrep -F "warning: log for ref $m has gap after $gd" e
412
'
412
-test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' '
413
+test_expect_success 'Query "main@{2005-05-26 23:38:00}" (middle of history)' '
414
test_when_finished "rm -f o e" &&
414
- git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
415
+ git rev-parse --verify "main@{2005-05-26 23:38:00}" >o 2>e &&
416
echo "$Z" >expect &&
417
test_cmp expect o &&
418
test_must_be_empty e
419
'
419
-test_expect_success 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' '
420
+test_expect_success 'Query "main@{2005-05-26 23:43:00}" (exact end of history)' '
421
test_when_finished "rm -f o e" &&
421
- git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
422
+ git rev-parse --verify "main@{2005-05-26 23:43:00}" >o 2>e &&
423
echo "$E" >expect &&
424
test_cmp expect o &&
425
test_must_be_empty e
426
'
426
-test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
427
+test_expect_success 'Query "main@{2005-05-28}" (past end of history)' '
428
test_when_finished "rm -f o e" &&
428
- git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
429
+ git rev-parse --verify "main@{2005-05-28}" >o 2>e &&
430
echo "$D" >expect &&
431
test_cmp expect o &&
432
test_i18ngrep -F "warning: log for ref $m unexpectedly ended on $ld" e
@@ -467,14 +468,14 @@ test_expect_success 'git commit logged updates' '
468
'
469
unset h_TEST h_OTHER h_FIXED h_MERGED
470
470
-test_expect_success 'git cat-file blob master:F (expect OTHER)' '
471
- test OTHER = $(git cat-file blob master:F)
471
+test_expect_success 'git cat-file blob main:F (expect OTHER)' '
472
+ test OTHER = $(git cat-file blob main:F)
473
'
473
-test_expect_success 'git cat-file blob master@{2005-05-26 23:30}:F (expect TEST)' '
474
- test TEST = $(git cat-file blob "master@{2005-05-26 23:30}:F")
474
+test_expect_success 'git cat-file blob main@{2005-05-26 23:30}:F (expect TEST)' '
475
+ test TEST = $(git cat-file blob "main@{2005-05-26 23:30}:F")
476
'
476
-test_expect_success 'git cat-file blob master@{2005-05-26 23:42}:F (expect OTHER)' '
477
- test OTHER = $(git cat-file blob "master@{2005-05-26 23:42}:F")
477
+test_expect_success 'git cat-file blob main@{2005-05-26 23:42}:F (expect OTHER)' '
478
+ test OTHER = $(git cat-file blob "main@{2005-05-26 23:42}:F")
479
'
480
481
# Test adding and deleting pseudorefs
@@ -586,21 +587,21 @@ test_expect_success 'stdin fails on unknown command' '
587
'
588
589
test_expect_success 'stdin fails on unbalanced quotes' '
589
- echo "create $a \"master" >stdin &&
590
+ echo "create $a \"main" >stdin &&
591
test_must_fail git update-ref --stdin <stdin 2>err &&
591
- grep "fatal: badly quoted argument: \\\"master" err
592
+ grep "fatal: badly quoted argument: \\\"main" err
593
'
594
594
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'stdin fails on invalid escape' '
595
+test_expect_success 'stdin fails on invalid escape' '
596
echo "create $a \"ma\zn\"" >stdin &&
597
test_must_fail git update-ref --stdin <stdin 2>err &&
598
grep "fatal: badly quoted argument: \\\"ma\\\\zn\\\"" err
599
'
600
601
test_expect_success 'stdin fails on junk after quoted argument' '
601
- echo "create \"$a\"master" >stdin &&
602
+ echo "create \"$a\"main" >stdin &&
603
test_must_fail git update-ref --stdin <stdin 2>err &&
603
- grep "fatal: unexpected character after quoted argument: \\\"$a\\\"master" err
604
+ grep "fatal: unexpected character after quoted argument: \\\"$a\\\"main" err
605
'
606
607
test_expect_success 'stdin fails create with no ref' '
@@ -710,7 +711,7 @@ test_expect_success 'stdin succeeds with quoted argument' '
711
test_cmp expect actual
712
'
713
713
-test_expect_success PREPARE_FOR_MAIN_BRANCH 'stdin succeeds with escaped character' '
714
+test_expect_success 'stdin succeeds with escaped character' '
715
git update-ref -d $a &&
716
echo "create $a \"ma\\151n\"" >stdin &&
717
git update-ref --stdin <stdin &&