Skip to content

Commit 27d7c85

Browse files
committed
Merge branch 'js/default-branch-name-tests-final-stretch'
Prepare tests not to be affected by the name of the default branch "git init" creates. * js/default-branch-name-tests-final-stretch: (28 commits) tests: drop prereq `PREPARE_FOR_MAIN_BRANCH` where no longer needed t99*: adjust the references to the default branch name "main" tests(git-p4): transition to the default branch name `main` t9[5-7]*: adjust the references to the default branch name "main" t9[0-4]*: adjust the references to the default branch name "main" t8*: adjust the references to the default branch name "main" t7[5-9]*: adjust the references to the default branch name "main" t7[0-4]*: adjust the references to the default branch name "main" t6[4-9]*: adjust the references to the default branch name "main" t64*: preemptively adjust alignment to prepare for `master` -> `main` t6[0-3]*: adjust the references to the default branch name "main" t5[6-9]*: adjust the references to the default branch name "main" t55[4-9]*: adjust the references to the default branch name "main" t55[23]*: adjust the references to the default branch name "main" t551*: adjust the references to the default branch name "main" t550*: adjust the references to the default branch name "main" t5503: prepare aligned comment for replacing `master` with `main` t5[0-4]*: adjust the references to the default branch name "main" t5323: prepare centered comment for `master` -> `main` t4*: adjust the references to the default branch name "main" ...
2 parents 440acfb + 8b70966 commit 27d7c85

File tree

355 files changed

+4403
-3436
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

355 files changed

+4403
-3436
lines changed

ci/run-build-and-tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ esac
1313
make
1414
case "$jobname" in
1515
linux-gcc)
16+
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
1617
make test
1718
export GIT_TEST_SPLIT_INDEX=yes
1819
export GIT_TEST_FULL_IN_PACK_ARRAY=true
@@ -22,6 +23,7 @@ linux-gcc)
2223
export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1
2324
export GIT_TEST_MULTI_PACK_INDEX=1
2425
export GIT_TEST_ADD_I_USE_BUILTIN=1
26+
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
2527
make test
2628
;;
2729
linux-clang)

t/annotate-tests.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ test_expect_success 'blame 2 authors' '
9595
'
9696

9797
test_expect_success 'setup B1 lines (branch1)' '
98-
git checkout -b branch1 master &&
98+
git checkout -b branch1 main &&
9999
echo "3A slow green fox jumps into the" >>file &&
100100
echo "well." >>file &&
101101
GIT_AUTHOR_NAME="B1" GIT_AUTHOR_EMAIL="[email protected]" \
@@ -107,7 +107,7 @@ test_expect_success 'blame 2 authors + 1 branch1 author' '
107107
'
108108

109109
test_expect_success 'setup B2 lines (branch2)' '
110-
git checkout -b branch2 master &&
110+
git checkout -b branch2 main &&
111111
sed -e "s/2A quick brown/4A quick brown lazy dog/" <file >file.new &&
112112
mv file.new file &&
113113
GIT_AUTHOR_NAME="B2" GIT_AUTHOR_EMAIL="[email protected]" \
@@ -131,11 +131,11 @@ test_expect_success 'blame --first-parent blames merge for branch1' '
131131
'
132132

133133
test_expect_success 'blame ancestor' '
134-
check_count -h master A 2 B 2
134+
check_count -h main A 2 B 2
135135
'
136136

137137
test_expect_success 'blame great-ancestor' '
138-
check_count -h master^ A 2
138+
check_count -h main^ A 2
139139
'
140140

141141
test_expect_success 'setup evil merge' '

t/lib-cvs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ setup_cvs_test_repository () {
3636
test_cvs_co () {
3737
# Usage: test_cvs_co BRANCH_NAME
3838
rm -rf module-cvs-"$1"
39-
if [ "$1" = "master" ]
39+
if [ "$1" = "main" ]
4040
then
4141
$CVS co -P -d module-cvs-"$1" -A module
4242
else

t/t0002-gitfile.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ test_description='.git file
44
55
Verify that plumbing commands work when .git is a file
66
'
7+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
8+
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
9+
710
. ./test-lib.sh
811

912
objpath() {
@@ -96,7 +99,7 @@ test_expect_success 'enter_repo non-strict mode' '
9699
git ls-remote enter_repo >actual &&
97100
cat >expected <<-EOF &&
98101
$head HEAD
99-
$head refs/heads/master
102+
$head refs/heads/main
100103
$head refs/tags/foo
101104
EOF
102105
test_cmp expected actual
@@ -111,7 +114,7 @@ test_expect_success 'enter_repo linked checkout' '
111114
git ls-remote foo >actual &&
112115
cat >expected <<-EOF &&
113116
$head HEAD
114-
$head refs/heads/master
117+
$head refs/heads/main
115118
$head refs/tags/foo
116119
EOF
117120
test_cmp expected actual
@@ -122,7 +125,7 @@ test_expect_success 'enter_repo strict mode' '
122125
git ls-remote --upload-pack="git upload-pack --strict" foo/.git >actual &&
123126
cat >expected <<-EOF &&
124127
$head HEAD
125-
$head refs/heads/master
128+
$head refs/heads/main
126129
$head refs/tags/foo
127130
EOF
128131
test_cmp expected actual

t/t0020-crlf.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
test_description='CRLF conversion'
44

5+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6+
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7+
58
. ./test-lib.sh
69

710
has_cr() {
@@ -318,8 +321,8 @@ test_expect_success 'checkout with existing .gitattributes' '
318321
git add .gitattributes .file &&
319322
git commit -m second &&
320323
321-
git checkout master~1 &&
322-
git checkout master &&
324+
git checkout main~1 &&
325+
git checkout main &&
323326
test "$(git diff-files --raw)" = ""
324327
325328
'
@@ -331,8 +334,8 @@ test_expect_success 'checkout when deleting .gitattributes' '
331334
git add .file2 &&
332335
git commit -m third &&
333336
334-
git checkout master~1 &&
335-
git checkout master &&
337+
git checkout main~1 &&
338+
git checkout main &&
336339
has_cr .file2
337340
338341
'

t/t0021-conversion.sh

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
test_description='blob conversion via gitattributes'
44

5+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6+
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7+
58
. ./test-lib.sh
69

710
TEST_ROOT="$PWD"
@@ -378,8 +381,8 @@ test_expect_success PERL 'required process filter should filter data' '
378381
test_cmp_count expected.log debug.log &&
379382
380383
git commit -m "test commit 2" &&
381-
MASTER=$(git rev-parse --verify master) &&
382-
META="ref=refs/heads/master treeish=$MASTER" &&
384+
MAIN=$(git rev-parse --verify main) &&
385+
META="ref=refs/heads/main treeish=$MAIN" &&
383386
rm -f test2.r "testsubdir/test3 '\''sq'\'',\$x=.r" &&
384387
385388
filter_git checkout --quiet --no-progress . &&
@@ -404,7 +407,7 @@ test_expect_success PERL 'required process filter should filter data' '
404407
EOF
405408
test_cmp_exclude_clean expected.log debug.log &&
406409
407-
filter_git checkout --quiet --no-progress master &&
410+
filter_git checkout --quiet --no-progress main &&
408411
cat >expected.log <<-EOF &&
409412
START
410413
init handshake complete
@@ -436,15 +439,15 @@ test_expect_success PERL 'required process filter should filter data for various
436439
M3=$(git hash-object "testsubdir/test3 '\''sq'\'',\$x=.r") &&
437440
EMPTY=$(git hash-object /dev/null) &&
438441
439-
MASTER=$(git rev-parse --verify master) &&
442+
MAIN=$(git rev-parse --verify main) &&
440443
441444
cp "$TEST_ROOT/test.o" test5.r &&
442445
git add test5.r &&
443446
git commit -m "test commit 3" &&
444447
git checkout empty-branch &&
445-
filter_git rebase --onto empty-branch master^^ master &&
446-
MASTER2=$(git rev-parse --verify master) &&
447-
META="ref=refs/heads/master treeish=$MASTER2" &&
448+
filter_git rebase --onto empty-branch main^^ main &&
449+
MAIN2=$(git rev-parse --verify main) &&
450+
META="ref=refs/heads/main treeish=$MAIN2" &&
448451
cat >expected.log <<-EOF &&
449452
START
450453
init handshake complete
@@ -458,8 +461,8 @@ test_expect_success PERL 'required process filter should filter data for various
458461
test_cmp_exclude_clean expected.log debug.log &&
459462
460463
git reset --hard empty-branch &&
461-
filter_git reset --hard $MASTER &&
462-
META="treeish=$MASTER" &&
464+
filter_git reset --hard $MAIN &&
465+
META="treeish=$MAIN" &&
463466
cat >expected.log <<-EOF &&
464467
START
465468
init handshake complete
@@ -471,10 +474,10 @@ test_expect_success PERL 'required process filter should filter data for various
471474
EOF
472475
test_cmp_exclude_clean expected.log debug.log &&
473476
474-
git branch old-master $MASTER &&
477+
git branch old-main $MAIN &&
475478
git reset --hard empty-branch &&
476-
filter_git reset --hard old-master &&
477-
META="ref=refs/heads/old-master treeish=$MASTER" &&
479+
filter_git reset --hard old-main &&
480+
META="ref=refs/heads/old-main treeish=$MAIN" &&
478481
cat >expected.log <<-EOF &&
479482
START
480483
init handshake complete
@@ -487,9 +490,9 @@ test_expect_success PERL 'required process filter should filter data for various
487490
test_cmp_exclude_clean expected.log debug.log &&
488491
489492
git checkout -b merge empty-branch &&
490-
git branch -f master $MASTER2 &&
491-
filter_git merge master &&
492-
META="treeish=$MASTER2" &&
493+
git branch -f main $MAIN2 &&
494+
filter_git merge main &&
495+
META="treeish=$MAIN2" &&
493496
cat >expected.log <<-EOF &&
494497
START
495498
init handshake complete
@@ -502,8 +505,8 @@ test_expect_success PERL 'required process filter should filter data for various
502505
EOF
503506
test_cmp_exclude_clean expected.log debug.log &&
504507
505-
filter_git archive master >/dev/null &&
506-
META="ref=refs/heads/master treeish=$MASTER2" &&
508+
filter_git archive main >/dev/null &&
509+
META="ref=refs/heads/main treeish=$MAIN2" &&
507510
cat >expected.log <<-EOF &&
508511
START
509512
init handshake complete
@@ -516,7 +519,7 @@ test_expect_success PERL 'required process filter should filter data for various
516519
EOF
517520
test_cmp_exclude_clean expected.log debug.log &&
518521
519-
TREE="$(git rev-parse $MASTER2^{tree})" &&
522+
TREE="$(git rev-parse $MAIN2^{tree})" &&
520523
filter_git archive $TREE >/dev/null &&
521524
META="treeish=$TREE" &&
522525
cat >expected.log <<-EOF &&
@@ -856,8 +859,8 @@ test_expect_success PERL 'delayed checkout in process filter' '
856859
) &&
857860
858861
S=$(test_file_size "$TEST_ROOT/test.o") &&
859-
PM="ref=refs/heads/master treeish=$(git -C repo rev-parse --verify master) " &&
860-
M="${PM}blob=$(git -C repo rev-parse --verify master:test.a)" &&
862+
PM="ref=refs/heads/main treeish=$(git -C repo rev-parse --verify main) " &&
863+
M="${PM}blob=$(git -C repo rev-parse --verify main:test.a)" &&
861864
cat >a.exp <<-EOF &&
862865
START
863866
init handshake complete

t/t0027-auto-crlf.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,9 @@ test_expect_success 'ls-files --eol -o Text/Binary' '
368368
test_cmp expect actual
369369
'
370370

371-
test_expect_success 'setup master' '
371+
test_expect_success 'setup main' '
372372
echo >.gitattributes &&
373-
git checkout -b master &&
373+
git checkout -b main &&
374374
git add .gitattributes &&
375375
git commit -m "add .gitattributes" . &&
376376
printf "\$Id: 0000000000000000000000000000000000000000 \$\nLINEONE\nLINETWO\nLINETHREE" >LF &&

t/t0028-working-tree-encoding.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
test_description='working-tree-encoding conversion via gitattributes'
44

5+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6+
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7+
58
. ./test-lib.sh
69

710
GIT_TRACE_WORKING_TREE_ENCODING=1 && export GIT_TRACE_WORKING_TREE_ENCODING
@@ -215,7 +218,7 @@ test_expect_success 'error if encoding round trip is not the same during refresh
215218
TEST_HASH=$(git hash-object --no-filters -w nonsense.utf16le) &&
216219
git update-index --add --cacheinfo 100644 $TEST_HASH nonsense.utf16le &&
217220
COMMIT=$(git commit-tree -p $(git rev-parse HEAD) -m "plain commit" $(git write-tree)) &&
218-
git update-ref refs/heads/master $COMMIT &&
221+
git update-ref refs/heads/main $COMMIT &&
219222
220223
test_must_fail git checkout HEAD^ 2>err.out &&
221224
test_i18ngrep "error: .* overwritten by checkout:" err.out
@@ -231,7 +234,7 @@ test_expect_success 'error if encoding garbage is already in Git' '
231234
TEST_HASH=$(git hash-object --no-filters -w nonsense.utf16) &&
232235
git update-index --add --cacheinfo 100644 $TEST_HASH nonsense.utf16 &&
233236
COMMIT=$(git commit-tree -p $(git rev-parse HEAD) -m "plain commit" $(git write-tree)) &&
234-
git update-ref refs/heads/master $COMMIT &&
237+
git update-ref refs/heads/main $COMMIT &&
235238
236239
git diff 2>err.out &&
237240
test_i18ngrep "error: BOM is required" err.out

t/t0041-usage.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
test_description='Test commands behavior when given invalid argument value'
44

5+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6+
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7+
58
. ./test-lib.sh
69

710
test_expect_success 'setup ' '
@@ -41,8 +44,8 @@ test_expect_success 'tag usage error' '
4144
'
4245

4346
test_expect_success 'branch --contains <existent_commit>' '
44-
git branch --contains "master" >actual 2>actual.err &&
45-
test_i18ngrep "master" actual &&
47+
git branch --contains "main" >actual 2>actual.err &&
48+
test_i18ngrep "main" actual &&
4649
test_line_count = 0 actual.err
4750
'
4851

@@ -54,7 +57,7 @@ test_expect_success 'branch --contains <inexistent_commit>' '
5457
'
5558

5659
test_expect_success 'branch --no-contains <existent_commit>' '
57-
git branch --no-contains "master" >actual 2>actual.err &&
60+
git branch --no-contains "main" >actual 2>actual.err &&
5861
test_line_count = 0 actual &&
5962
test_line_count = 0 actual.err
6063
'
@@ -73,7 +76,7 @@ test_expect_success 'branch usage error' '
7376
'
7477

7578
test_expect_success 'for-each-ref --contains <existent_object>' '
76-
git for-each-ref --contains "master" >actual 2>actual.err &&
79+
git for-each-ref --contains "main" >actual 2>actual.err &&
7780
test_line_count = 2 actual &&
7881
test_line_count = 0 actual.err
7982
'
@@ -86,7 +89,7 @@ test_expect_success 'for-each-ref --contains <inexistent_object>' '
8689
'
8790

8891
test_expect_success 'for-each-ref --no-contains <existent_object>' '
89-
git for-each-ref --no-contains "master" >actual 2>actual.err &&
92+
git for-each-ref --no-contains "main" >actual 2>actual.err &&
9093
test_line_count = 0 actual &&
9194
test_line_count = 0 actual.err
9295
'

t/t0050-filesystem.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
test_description='Various filesystem issues'
44

5+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6+
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7+
58
. ./test-lib.sh
69

710
auml=$(printf '\303\244')
@@ -65,7 +68,7 @@ test_expect_success "setup case tests" '
6568
git mv camelcase tmp &&
6669
git mv tmp CamelCase &&
6770
git commit -m "rename" &&
68-
git checkout -f master
71+
git checkout -f main
6972
'
7073

7174
test_expect_success 'rename (case change)' '
@@ -118,7 +121,7 @@ test_expect_success "setup unicode normalization tests" '
118121
git mv $aumlcdiar tmp &&
119122
git mv tmp "$auml" &&
120123
git commit -m rename &&
121-
git checkout -f master
124+
git checkout -f main
122125
'
123126

124127
$test_unicode 'rename (silent unicode normalization)' '
@@ -147,7 +150,7 @@ test_expect_success CASE_INSENSITIVE_FS 'checkout with no pathspec and a case in
147150
git add gitweb &&
148151
git commit -m "add gitweb/subdir/file" &&
149152
150-
git checkout master
153+
git checkout main
151154
)
152155
'
153156

0 commit comments

Comments
 (0)