t5[0-4]*: adjust the references to the default branch name "main"
Carefully excluding t5310, which is developed independently of the current patch series at the time of writing, we now use `main` as default branch in t5[0-4]*. This trick was performed via $ (cd t && sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \ -e 's/Master/Main/g' -- t5[0-4]*.sh && git checkout HEAD -- t5310\*) This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main` for those tests. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Nov 18, 2020 at 23:44 UTC
966b4be2765a9bd80febfd4660a1fa9e6408d143
15 files changed
+131
-131
t/t5150-request-pull.sh
+18
-18
@@ -2,7 +2,7 @@
2
3
test_description='Test workflows involving pull request.'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -34,13 +34,13 @@ test_expect_success 'setup' '
34
test_tick &&
35
git commit -m "\"Thirty days\", a reminder of month lengths" &&
36
git tag -m "version 1" -a initial &&
37
- git push --tags origin master
37
+ git push --tags origin main
38
) &&
39
(
40
cd local &&
41
git remote add upstream "$trash_url/upstream.git" &&
42
git fetch upstream &&
43
- git pull upstream master &&
43
+ git pull upstream main &&
44
cat <<-\EOT >>mnemonic.txt &&
45
Of twyecescore-eightt is but eine,
46
And all the remnante be thrycescore-eine.
@@ -62,7 +62,7 @@ test_expect_success 'setup' '
62
git commit -a -m "Adapt to use modern, simpler English
63
64
But keep the old version, too, in case some people prefer it." &&
65
- git checkout master
65
+ git checkout main
66
)
67
68
'
@@ -132,7 +132,7 @@ test_expect_success 'pull request when forgot to push' '
132
(
133
cd local &&
134
git checkout initial &&
135
- git merge --ff-only master &&
135
+ git merge --ff-only main &&
136
test_must_fail git request-pull initial "$downstream_url" \
137
2>../err
138
) &&
@@ -148,9 +148,9 @@ test_expect_success 'pull request after push' '
148
(
149
cd local &&
150
git checkout initial &&
151
- git merge --ff-only master &&
152
- git push origin master:for-upstream &&
153
- git request-pull initial origin master:for-upstream >../request
151
+ git merge --ff-only main &&
152
+ git push origin main:for-upstream &&
153
+ git request-pull initial origin main:for-upstream >../request
154
) &&
155
sed -nf read-request.sed <request >digest &&
156
{
@@ -175,9 +175,9 @@ test_expect_success 'request asks HEAD to be pulled' '
175
(
176
cd local &&
177
git checkout initial &&
178
- git merge --ff-only master &&
179
- git push --tags origin master simplify &&
180
- git push origin master:for-upstream &&
178
+ git merge --ff-only main &&
179
+ git push --tags origin main simplify &&
180
+ git push origin main:for-upstream &&
181
git request-pull initial "$downstream_url" >../request
182
) &&
183
sed -nf read-request.sed <request >digest &&
@@ -218,7 +218,7 @@ test_expect_success 'pull request format' '
218
(
219
cd local &&
220
git checkout initial &&
221
- git merge --ff-only master &&
221
+ git merge --ff-only main &&
222
git push origin tags/full &&
223
git request-pull initial "$downstream_url" tags/full >../request
224
) &&
@@ -246,9 +246,9 @@ test_expect_success 'request-pull ignores OPTIONS_KEEPDASHDASH poison' '
246
OPTIONS_KEEPDASHDASH=Yes &&
247
export OPTIONS_KEEPDASHDASH &&
248
git checkout initial &&
249
- git merge --ff-only master &&
250
- git push origin master:for-upstream &&
251
- git request-pull -- initial "$downstream_url" master:for-upstream >../request
249
+ git merge --ff-only main &&
250
+ git push origin main:for-upstream &&
251
+ git request-pull -- initial "$downstream_url" main:for-upstream >../request
252
)
253
254
'
@@ -260,7 +260,7 @@ test_expect_success 'request-pull quotes regex metacharacters properly' '
260
(
261
cd local &&
262
git checkout initial &&
263
- git merge --ff-only master &&
263
+ git merge --ff-only main &&
264
git tag -mrelease v2.0 &&
265
git push origin refs/tags/v2.0:refs/tags/v2-0 &&
266
test_must_fail git request-pull initial "$downstream_url" tags/v2.0 \
@@ -278,7 +278,7 @@ test_expect_success 'pull request with mismatched object' '
278
(
279
cd local &&
280
git checkout initial &&
281
- git merge --ff-only master &&
281
+ git merge --ff-only main &&
282
git push origin HEAD:refs/tags/full &&
283
test_must_fail git request-pull initial "$downstream_url" tags/full \
284
2>../err
@@ -295,7 +295,7 @@ test_expect_success 'pull request with stale object' '
295
(
296
cd local &&
297
git checkout initial &&
298
- git merge --ff-only master &&
298
+ git merge --ff-only main &&
299
git push origin refs/tags/full &&
300
git tag -f -m"Thirty-one days" full &&
301
test_must_fail git request-pull initial "$downstream_url" tags/full \
t/t5304-prune.sh
+2
-2
@@ -4,7 +4,7 @@
4
#
5
6
test_description='prune'
7
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
7
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
8
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
9
10
. ./test-lib.sh
@@ -122,7 +122,7 @@ test_expect_success 'prune: do not prune detached HEAD with no reflog' '
122
test_expect_success 'prune: prune former HEAD after checking out branch' '
123
124
head_oid=$(git rev-parse HEAD) &&
125
- git checkout --quiet master &&
125
+ git checkout --quiet main &&
126
git prune -v >prune_actual &&
127
grep "$head_oid" prune_actual
128
t/t5305-include-tag.sh
+2
-2
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='git pack-object --include-tag'
4
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
4
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7
. ./test-lib.sh
@@ -114,7 +114,7 @@ test_expect_success 'check unpacked result (have all objects)' '
114
115
test_expect_success 'single-branch clone can transfer tag' '
116
rm -rf clone.git &&
117
- git clone --no-local --single-branch -b master . clone.git &&
117
+ git clone --no-local --single-branch -b main . clone.git &&
118
git -C clone.git fsck
119
'
120
t/t5312-prune-corruption.sh
+9
-9
@@ -8,7 +8,7 @@ bail out or to proceed using it as a reachable tip, but it is _not_
8
OK to proceed as if it did not exist. Otherwise we might silently
9
delete objects that cannot be recovered.
10
'
11
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
11
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
12
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
13
14
. ./test-lib.sh
@@ -19,7 +19,7 @@ test_expect_success 'disable reflogs' '
19
'
20
21
test_expect_success 'create history reachable only from a bogus-named ref' '
22
- test_tick && git commit --allow-empty -m master &&
22
+ test_tick && git commit --allow-empty -m main &&
23
base=$(git rev-parse HEAD) &&
24
test_tick && git commit --allow-empty -m bogus &&
25
bogus=$(git rev-parse HEAD) &&
@@ -54,7 +54,7 @@ test_expect_success 'clean up bogus ref' '
54
'
55
56
# We create two new objects here, "one" and "two". Our
57
-# master branch points to "two", which is deleted,
57
+# main branch points to "two", which is deleted,
58
# corrupting the repository. But we'd like to make sure
59
# that the otherwise unreachable "one" is not pruned
60
# (since it is the user's best bet for recovering
@@ -84,7 +84,7 @@ test_expect_success 'pruning with a corrupted tip does not drop history' '
84
test_expect_success 'pack-refs does not silently delete broken loose ref' '
85
git pack-refs --all --prune &&
86
echo $missing >expect &&
87
- git rev-parse refs/heads/master >actual &&
87
+ git rev-parse refs/heads/main >actual &&
88
test_cmp expect actual
89
'
90
@@ -92,25 +92,25 @@ test_expect_success 'pack-refs does not silently delete broken loose ref' '
92
# actually pack it, as it is perfectly reasonable to
93
# skip processing a broken ref
94
test_expect_success 'create packed-refs file with broken ref' '
95
- rm -f .git/refs/heads/master &&
95
+ rm -f .git/refs/heads/main &&
96
cat >.git/packed-refs <<-EOF &&
97
- $missing refs/heads/master
97
+ $missing refs/heads/main
98
$recoverable refs/heads/other
99
EOF
100
echo $missing >expect &&
101
- git rev-parse refs/heads/master >actual &&
101
+ git rev-parse refs/heads/main >actual &&
102
test_cmp expect actual
103
'
104
105
test_expect_success 'pack-refs does not silently delete broken packed ref' '
106
git pack-refs --all --prune &&
107
- git rev-parse refs/heads/master >actual &&
107
+ git rev-parse refs/heads/main >actual &&
108
test_cmp expect actual
109
'
110
111
test_expect_success 'pack-refs does not drop broken refs during deletion' '
112
git update-ref -d refs/heads/other &&
113
- git rev-parse refs/heads/master >actual &&
113
+ git rev-parse refs/heads/main >actual &&
114
test_cmp expect actual
115
'
116
t/t5317-pack-objects-filter-objects.sh
+2
-2
@@ -2,7 +2,7 @@
2
3
test_description='git pack-objects using object filtering'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -385,7 +385,7 @@ test_expect_success 'verify sparse:oid=oid-ish' '
385
awk -f print_2.awk ls_files_result |
386
sort >expected &&
387
388
- git -C r4 pack-objects --revs --stdout --filter=sparse:oid=master:pattern >filter.pack <<-EOF &&
388
+ git -C r4 pack-objects --revs --stdout --filter=sparse:oid=main:pattern >filter.pack <<-EOF &&
389
HEAD
390
EOF
391
git -C r4 index-pack ../filter.pack &&
t/t5322-pack-objects-sparse.sh
+2
-2
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='pack-objects object selection using sparse algorithm'
4
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
4
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7
. ./test-lib.sh
@@ -21,7 +21,7 @@ test_expect_success 'setup repo' '
21
git commit -m "Initialized trees" &&
22
for i in $(test_seq 1 3)
23
do
24
- git checkout -b topic$i master &&
24
+ git checkout -b topic$i main &&
25
echo change-$i >f$i/f$i/data.txt &&
26
git commit -a -m "Changed f$i/f$i/data.txt"
27
done &&
t/t5323-pack-redundant.sh
+33
-33
@@ -6,7 +6,7 @@
6
test_description='Test git pack-redundant
7
8
In order to test git-pack-redundant, we will create a number of objects and
9
-packs in the repository `master.git`. The relationship between packs (P1-P8)
9
+packs in the repository `main.git`. The relationship between packs (P1-P8)
10
and objects (T, A-R) is showed in the following chart. Objects of a pack will
11
be marked with letter x, while objects of redundant packs will be marked with
12
exclamation point, and redundant pack itself will be marked with asterisk.
@@ -25,7 +25,7 @@ exclamation point, and redundant pack itself will be marked with asterisk.
25
ALL | x x x x x x x x x x x x x x x x x x x
26
27
Another repository `shared.git` has unique objects (X-Z), while other objects
28
-(marked with letter s) are shared through alt-odb (of `master.git`). The
28
+(marked with letter s) are shared through alt-odb (of `main.git`). The
29
relationship between packs and objects is as follows:
30
31
| T A B C D E F G H I J K L M N O P Q R X Y Z
@@ -36,7 +36,7 @@ relationship between packs and objects is as follows:
36
37
. ./test-lib.sh
38
39
-master_repo=master.git
39
+main_repo=main.git
40
shared_repo=shared.git
41
42
# Create commits in <repo> and assign each commit's oid to shell variables
@@ -69,7 +69,7 @@ create_commits_in () {
69
shift ||
70
return 1
71
done &&
72
- git -C "$repo" update-ref refs/heads/master $oid
72
+ git -C "$repo" update-ref refs/heads/main $oid
73
}
74
75
# Create pack in <repo> and assign pack id to variable given in the 2nd argument
@@ -107,9 +107,9 @@ format_packfiles () {
107
sort
108
}
109
110
-test_expect_success 'setup master repo' '
111
- git init --bare "$master_repo" &&
112
- create_commits_in "$master_repo" A B C D E F G H I J K L M N O P Q R
110
+test_expect_success 'setup main repo' '
111
+ git init --bare "$main_repo" &&
112
+ create_commits_in "$main_repo" A B C D E F G H I J K L M N O P Q R
113
'
114
115
#############################################################################
@@ -124,8 +124,8 @@ test_expect_success 'setup master repo' '
124
# ALL | x x x x x x x x x x x x x x x
125
#
126
#############################################################################
127
-test_expect_success 'master: no redundant for pack 1, 2, 3' '
128
- create_pack_in "$master_repo" P1 <<-EOF &&
127
+test_expect_success 'main: no redundant for pack 1, 2, 3' '
128
+ create_pack_in "$main_repo" P1 <<-EOF &&
129
$T
130
$A
131
$B
@@ -135,7 +135,7 @@ test_expect_success 'master: no redundant for pack 1, 2, 3' '
135
$F
136
$R
137
EOF
138
- create_pack_in "$master_repo" P2 <<-EOF &&
138
+ create_pack_in "$main_repo" P2 <<-EOF &&
139
$B
140
$C
141
$D
@@ -144,7 +144,7 @@ test_expect_success 'master: no redundant for pack 1, 2, 3' '
144
$H
145
$I
146
EOF
147
- create_pack_in "$master_repo" P3 <<-EOF &&
147
+ create_pack_in "$main_repo" P3 <<-EOF &&
148
$F
149
$I
150
$J
@@ -153,7 +153,7 @@ test_expect_success 'master: no redundant for pack 1, 2, 3' '
153
$M
154
EOF
155
(
156
- cd "$master_repo" &&
156
+ cd "$main_repo" &&
157
git pack-redundant --all >out &&
158
test_must_be_empty out
159
)
@@ -173,22 +173,22 @@ test_expect_success 'master: no redundant for pack 1, 2, 3' '
173
# ALL | x x x x x x x x x x x x x x x x x x
174
#
175
#############################################################################
176
-test_expect_success 'master: one of pack-2/pack-3 is redundant' '
177
- create_pack_in "$master_repo" P4 <<-EOF &&
176
+test_expect_success 'main: one of pack-2/pack-3 is redundant' '
177
+ create_pack_in "$main_repo" P4 <<-EOF &&
178
$J
179
$K
180
$L
181
$M
182
$P
183
EOF
184
- create_pack_in "$master_repo" P5 <<-EOF &&
184
+ create_pack_in "$main_repo" P5 <<-EOF &&
185
$G
186
$H
187
$N
188
$O
189
EOF
190
(
191
- cd "$master_repo" &&
191
+ cd "$main_repo" &&
192
cat >expect <<-EOF &&
193
P3:$P3
194
EOF
@@ -214,18 +214,18 @@ test_expect_success 'master: one of pack-2/pack-3 is redundant' '
214
# ALL | x x x x x x x x x x x x x x x x x x x
215
#
216
#############################################################################
217
-test_expect_success 'master: pack 2, 4, and 6 are redundant' '
218
- create_pack_in "$master_repo" P6 <<-EOF &&
217
+test_expect_success 'main: pack 2, 4, and 6 are redundant' '
218
+ create_pack_in "$main_repo" P6 <<-EOF &&
219
$N
220
$O
221
$Q
222
EOF
223
- create_pack_in "$master_repo" P7 <<-EOF &&
223
+ create_pack_in "$main_repo" P7 <<-EOF &&
224
$P
225
$Q
226
EOF
227
(
228
- cd "$master_repo" &&
228
+ cd "$main_repo" &&
229
cat >expect <<-EOF &&
230
P2:$P2
231
P4:$P4
@@ -254,12 +254,12 @@ test_expect_success 'master: pack 2, 4, and 6 are redundant' '
254
# ALL | x x x x x x x x x x x x x x x x x x x
255
#
256
#############################################################################
257
-test_expect_success 'master: pack-8 (subset of pack-1) is also redundant' '
258
- create_pack_in "$master_repo" P8 <<-EOF &&
257
+test_expect_success 'main: pack-8 (subset of pack-1) is also redundant' '
258
+ create_pack_in "$main_repo" P8 <<-EOF &&
259
$A
260
EOF
261
(
262
- cd "$master_repo" &&
262
+ cd "$main_repo" &&
263
cat >expect <<-EOF &&
264
P2:$P2
265
P4:$P4
@@ -272,18 +272,18 @@ test_expect_success 'master: pack-8 (subset of pack-1) is also redundant' '
272
)
273
'
274
275
-test_expect_success 'master: clean loose objects' '
275
+test_expect_success 'main: clean loose objects' '
276
(
277
- cd "$master_repo" &&
277
+ cd "$main_repo" &&
278
git prune-packed &&
279
find objects -type f | sed -e "/objects\/pack\//d" >out &&
280
test_must_be_empty out
281
)
282
'
283
284
-test_expect_success 'master: remove redundant packs and pass fsck' '
284
+test_expect_success 'main: remove redundant packs and pass fsck' '
285
(
286
- cd "$master_repo" &&
286
+ cd "$main_repo" &&
287
git pack-redundant --all | xargs rm &&
288
git fsck &&
289
git pack-redundant --all >out &&
@@ -292,12 +292,12 @@ test_expect_success 'master: remove redundant packs and pass fsck' '
292
'
293
294
# The following test cases will execute inside `shared.git`, instead of
295
-# inside `master.git`.
295
+# inside `main.git`.
296
test_expect_success 'setup shared.git' '
297
- git clone --mirror "$master_repo" "$shared_repo" &&
297
+ git clone --mirror "$main_repo" "$shared_repo" &&
298
(
299
cd "$shared_repo" &&
300
- printf "../../$master_repo/objects\n" >objects/info/alternates
300
+ printf "../../$main_repo/objects\n" >objects/info/alternates
301
)
302
'
303
@@ -312,7 +312,7 @@ test_expect_success 'shared: all packs are redundant, but no output without --al
312
#############################################################################
313
# Chart of packs and objects for this test case
314
#
315
-# ================= master.git ================
315
+# ================= main.git ================
316
# | T A B C D E F G H I J K L M N O P Q R <----------+
317
# ----+-------------------------------------- |
318
# P1 | x x x x x x x x |
@@ -394,7 +394,7 @@ test_expect_success 'shared: no redundant without --alt-odb' '
394
#############################################################################
395
# Chart of packs and objects for this test case
396
#
397
-# ================= master.git ================
397
+# ================= main.git ================
398
# | T A B C D E F G H I J K L M N O P Q R <----------------+
399
# ----+-------------------------------------- |
400
# P1 | x x x x x x x x |
@@ -426,7 +426,7 @@ test_expect_success 'shared: one pack is redundant with --alt-odb' '
426
#############################################################################
427
# Chart of packs and objects for this test case
428
#
429
-# ================= master.git ================
429
+# ================= main.git ================
430
# | T A B C D E F G H I J K L M N O P Q R <----------------+
431
# ----+-------------------------------------- |
432
# P1 | x x x x x x x x |
t/t5400-send-pack.sh
+31
-31
@@ -6,7 +6,7 @@
6
test_description='See why rewinding head breaks send-pack
7
8
'
9
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
9
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
10
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
11
12
. ./test-lib.sh
@@ -69,20 +69,20 @@ test_expect_success 'pack the destination repository' '
69
'
70
71
test_expect_success 'refuse pushing rewound head without --force' '
72
- pushed_head=$(git rev-parse --verify master) &&
73
- victim_orig=$(cd victim && git rev-parse --verify master) &&
74
- test_must_fail git send-pack ./victim master &&
75
- victim_head=$(cd victim && git rev-parse --verify master) &&
72
+ pushed_head=$(git rev-parse --verify main) &&
73
+ victim_orig=$(cd victim && git rev-parse --verify main) &&
74
+ test_must_fail git send-pack ./victim main &&
75
+ victim_head=$(cd victim && git rev-parse --verify main) &&
76
test "$victim_head" = "$victim_orig" &&
77
# this should update
78
- git send-pack --force ./victim master &&
79
- victim_head=$(cd victim && git rev-parse --verify master) &&
78
+ git send-pack --force ./victim main &&
79
+ victim_head=$(cd victim && git rev-parse --verify main) &&
80
test "$victim_head" = "$pushed_head"
81
'
82
83
test_expect_success 'push can be used to delete a ref' '
84
- ( cd victim && git branch extra master ) &&
85
- git send-pack ./victim :extra master &&
84
+ ( cd victim && git branch extra main ) &&
85
+ git send-pack ./victim :extra main &&
86
( cd victim &&
87
test_must_fail git rev-parse --verify extra )
88
'
@@ -92,9 +92,9 @@ test_expect_success 'refuse deleting push with denyDeletes' '
92
cd victim &&
93
test_might_fail git branch -D extra &&
94
git config receive.denyDeletes true &&
95
- git branch extra master
95
+ git branch extra main
96
) &&
97
- test_must_fail git send-pack ./victim :extra master
97
+ test_must_fail git send-pack ./victim :extra main
98
'
99
100
test_expect_success 'cannot override denyDeletes with git -c send-pack' '
@@ -102,10 +102,10 @@ test_expect_success 'cannot override denyDeletes with git -c send-pack' '
102
cd victim &&
103
test_might_fail git branch -D extra &&
104
git config receive.denyDeletes true &&
105
- git branch extra master
105
+ git branch extra main
106
) &&
107
test_must_fail git -c receive.denyDeletes=false \
108
- send-pack ./victim :extra master
108
+ send-pack ./victim :extra main
109
'
110
111
test_expect_success 'override denyDeletes with git -c receive-pack' '
@@ -113,11 +113,11 @@ test_expect_success 'override denyDeletes with git -c receive-pack' '
113
cd victim &&
114
test_might_fail git branch -D extra &&
115
git config receive.denyDeletes true &&
116
- git branch extra master
116
+ git branch extra main
117
) &&
118
git send-pack \
119
--receive-pack="git -c receive.denyDeletes=false receive-pack" \
120
- ./victim :extra master
120
+ ./victim :extra main
121
'
122
123
test_expect_success 'denyNonFastforwards trumps --force' '
@@ -126,9 +126,9 @@ test_expect_success 'denyNonFastforwards trumps --force' '
126
test_might_fail git branch -D extra &&
127
git config receive.denyNonFastforwards true
128
) &&
129
- victim_orig=$(cd victim && git rev-parse --verify master) &&
130
- test_must_fail git send-pack --force ./victim master^:master &&
131
- victim_head=$(cd victim && git rev-parse --verify master) &&
129
+ victim_orig=$(cd victim && git rev-parse --verify main) &&
130
+ test_must_fail git send-pack --force ./victim main^:main &&
131
+ victim_head=$(cd victim && git rev-parse --verify main) &&
132
test "$victim_orig" = "$victim_head"
133
'
134
@@ -213,41 +213,41 @@ rewound_push_setup() {
213
214
test_expect_success 'pushing explicit refspecs respects forcing' '
215
rewound_push_setup &&
216
- parent_orig=$(cd parent && git rev-parse --verify master) &&
216
+ parent_orig=$(cd parent && git rev-parse --verify main) &&
217
(
218
cd child &&
219
test_must_fail git send-pack ../parent \
220
- refs/heads/master:refs/heads/master
220
+ refs/heads/main:refs/heads/main
221
) &&
222
- parent_head=$(cd parent && git rev-parse --verify master) &&
222
+ parent_head=$(cd parent && git rev-parse --verify main) &&
223
test "$parent_orig" = "$parent_head" &&
224
(
225
cd child &&
226
git send-pack ../parent \
227
- +refs/heads/master:refs/heads/master
227
+ +refs/heads/main:refs/heads/main
228
) &&
229
- parent_head=$(cd parent && git rev-parse --verify master) &&
230
- child_head=$(cd child && git rev-parse --verify master) &&
229
+ parent_head=$(cd parent && git rev-parse --verify main) &&
230
+ child_head=$(cd child && git rev-parse --verify main) &&
231
test "$parent_head" = "$child_head"
232
'
233
234
test_expect_success 'pushing wildcard refspecs respects forcing' '
235
rewound_push_setup &&
236
- parent_orig=$(cd parent && git rev-parse --verify master) &&
236
+ parent_orig=$(cd parent && git rev-parse --verify main) &&
237
(
238
cd child &&
239
test_must_fail git send-pack ../parent \
240
"refs/heads/*:refs/heads/*"
241
) &&
242
- parent_head=$(cd parent && git rev-parse --verify master) &&
242
+ parent_head=$(cd parent && git rev-parse --verify main) &&
243
test "$parent_orig" = "$parent_head" &&
244
(
245
cd child &&
246
git send-pack ../parent \
247
"+refs/heads/*:refs/heads/*"
248
) &&
249
- parent_head=$(cd parent && git rev-parse --verify master) &&
250
- child_head=$(cd child && git rev-parse --verify master) &&
249
+ parent_head=$(cd parent && git rev-parse --verify main) &&
250
+ child_head=$(cd child && git rev-parse --verify main) &&
251
test "$parent_head" = "$child_head"
252
'
253
@@ -255,7 +255,7 @@ test_expect_success 'deny pushing to delete current branch' '
255
rewound_push_setup &&
256
(
257
cd child &&
258
- test_must_fail git send-pack ../parent :refs/heads/master 2>errs
258
+ test_must_fail git send-pack ../parent :refs/heads/main 2>errs
259
)
260
'
261
@@ -286,9 +286,9 @@ test_expect_success 'receive-pack de-dupes .have lines' '
286
local=$(git -C fork rev-parse HEAD) &&
287
shared=$(git -C shared rev-parse only-shared) &&
288
cat >expect <<-EOF &&
289
- $local refs/heads/master
289
+ $local refs/heads/main
290
$local refs/remotes/origin/HEAD
291
- $local refs/remotes/origin/master
291
+ $local refs/remotes/origin/main
292
$shared .have
293
EOF
294
t/t5401-update-hooks.sh
+12
-12
@@ -15,11 +15,11 @@ test_expect_success setup '
15
git update-index a &&
16
tree1=$(git write-tree) &&
17
commit1=$(echo modify | git commit-tree $tree1 -p $commit0) &&
18
- git update-ref refs/heads/master $commit0 &&
18
+ git update-ref refs/heads/main $commit0 &&
19
git update-ref refs/heads/tofail $commit1 &&
20
git clone --bare ./. victim.git &&
21
GIT_DIR=victim.git git update-ref refs/heads/tofail $commit1 &&
22
- git update-ref refs/heads/master $commit1 &&
22
+ git update-ref refs/heads/main $commit1 &&
23
git update-ref refs/heads/tofail $commit0
24
'
25
@@ -38,7 +38,7 @@ echo "$@" >>$GIT_DIR/update.args
38
read x; printf %s "$x" >$GIT_DIR/update.stdin
39
echo STDOUT update $1
40
echo STDERR update $1 >&2
41
-test "$1" = refs/heads/master || exit
41
+test "$1" = refs/heads/main || exit
42
EOF
43
chmod u+x victim.git/hooks/update
44
@@ -62,11 +62,11 @@ chmod u+x victim.git/hooks/post-update
62
63
test_expect_success push '
64
test_must_fail git send-pack --force ./victim.git \
65
- master tofail >send.out 2>send.err
65
+ main tofail >send.out 2>send.err
66
'
67
68
test_expect_success 'updated as expected' '
69
- test $(GIT_DIR=victim.git git rev-parse master) = $commit1 &&
69
+ test $(GIT_DIR=victim.git git rev-parse main) = $commit1 &&
70
test $(GIT_DIR=victim.git git rev-parse tofail) = $commit1
71
'
72
@@ -82,24 +82,24 @@ test_expect_success 'hooks ran' '
82
'
83
84
test_expect_success 'pre-receive hook input' '
85
- (echo $commit0 $commit1 refs/heads/master &&
85
+ (echo $commit0 $commit1 refs/heads/main &&
86
echo $commit1 $commit0 refs/heads/tofail
87
) | test_cmp - victim.git/pre-receive.stdin
88
'
89
90
test_expect_success 'update hook arguments' '
91
- (echo refs/heads/master $commit0 $commit1 &&
91
+ (echo refs/heads/main $commit0 $commit1 &&
92
echo refs/heads/tofail $commit1 $commit0
93
) | test_cmp - victim.git/update.args
94
'
95
96
test_expect_success 'post-receive hook input' '
97
- echo $commit0 $commit1 refs/heads/master |
97
+ echo $commit0 $commit1 refs/heads/main |
98
test_cmp - victim.git/post-receive.stdin
99
'
100
101
test_expect_success 'post-update hook arguments' '
102
- echo refs/heads/master |
102
+ echo refs/heads/main |
103
test_cmp - victim.git/post-update.args
104
'
105
@@ -120,8 +120,8 @@ test_expect_success 'send-pack produced no output' '
120
cat <<EOF >expect
121
remote: STDOUT pre-receive
122
remote: STDERR pre-receive
123
-remote: STDOUT update refs/heads/master
124
-remote: STDERR update refs/heads/master
123
+remote: STDOUT update refs/heads/main
124
+remote: STDERR update refs/heads/main
125
remote: STDOUT update refs/heads/tofail
126
remote: STDERR update refs/heads/tofail
127
remote: error: hook declined to update refs/heads/tofail
@@ -143,7 +143,7 @@ test_expect_success 'pre-receive hook that forgets to read its input' '
143
144
for v in $(test_seq 100 999)
145
do
146
- git branch branch_$v master || return
146
+ git branch branch_$v main || return
147
done &&
148
git push ./victim.git "+refs/heads/*:refs/heads/*"
149
'
t/t5402-post-merge-hook.sh
+2
-2
@@ -4,7 +4,7 @@
4
#
5
6
test_description='Test the post-merge hook.'
7
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
7
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
8
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
9
10
. ./test-lib.sh
@@ -18,7 +18,7 @@ test_expect_success setup '
18
git update-index a &&
19
tree1=$(git write-tree) &&
20
commit1=$(echo modify | git commit-tree $tree1 -p $commit0) &&
21
- git update-ref refs/heads/master $commit0 &&
21
+ git update-ref refs/heads/main $commit0 &&
22
git clone ./. clone1 &&
23
GIT_DIR=clone1/.git git update-index --add a &&
24
git clone ./. clone2 &&
t/t5403-post-checkout-hook.sh
+4
-4
@@ -4,7 +4,7 @@
4
#
5
6
test_description='Test the post-checkout hook.'
7
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
7
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
8
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
9
10
. ./test-lib.sh
@@ -23,7 +23,7 @@ test_expect_success setup '
23
24
test_expect_success 'post-checkout receives the right arguments with HEAD unchanged ' '
25
test_when_finished "rm -f .git/post-checkout.args" &&
26
- git checkout master &&
26
+ git checkout main &&
27
read old new flag <.git/post-checkout.args &&
28
test $old = $new && test $flag = 1
29
'
@@ -44,14 +44,14 @@ test_expect_success 'post-checkout receives the right args with HEAD changed ' '
44
45
test_expect_success 'post-checkout receives the right args when not switching branches ' '
46
test_when_finished "rm -f .git/post-checkout.args" &&
47
- git checkout master -- three.t &&
47
+ git checkout main -- three.t &&
48
read old new flag <.git/post-checkout.args &&
49
test $old = $new && test $flag = 0
50
'
51
52
test_expect_success 'post-checkout is triggered on rebase' '
53
test_when_finished "rm -f .git/post-checkout.args" &&
54
- git checkout -b rebase-test master &&
54
+ git checkout -b rebase-test main &&
55
rm -f .git/post-checkout.args &&
56
git rebase rebase-on-me &&
57
read old new flag <.git/post-checkout.args &&
t/t5404-tracking-branches.sh
+5
-5
@@ -2,7 +2,7 @@
2
3
test_description='tracking branch update checks for git push'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -33,9 +33,9 @@ test_expect_success 'prepare pushable branches' '
33
git checkout -b b2 origin/b2 &&
34
echo aa-b2 >>file &&
35
git commit -a -m aa-b2 &&
36
- git checkout master &&
37
- echo aa-master >>file &&
38
- git commit -a -m aa-master
36
+ git checkout main &&
37
+ echo aa-main >>file &&
38
+ git commit -a -m aa-main
39
'
40
41
test_expect_success 'mixed-success push returns error' '
@@ -43,7 +43,7 @@ test_expect_success 'mixed-success push returns error' '
43
'
44
45
test_expect_success 'check tracking branches updated correctly after push' '
46
- test "$(git rev-parse origin/master)" = "$(git rev-parse master)"
46
+ test "$(git rev-parse origin/main)" = "$(git rev-parse main)"
47
'
48
49
test_expect_success 'check tracking branches not updated for failed refs' '
t/t5405-send-pack-rewind.sh
+4
-4
@@ -2,7 +2,7 @@
2
3
test_description='forced push to replace commit we do not have'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -16,7 +16,7 @@ test_expect_success setup '
16
mkdir another && (
17
cd another &&
18
git init &&
19
- git fetch --update-head-ok .. master:master
19
+ git fetch --update-head-ok .. main:main
20
) &&
21
22
>file2 && git add file2 && test_tick &&
@@ -28,7 +28,7 @@ test_expect_success 'non forced push should die not segfault' '
28
29
(
30
cd another &&
31
- test_must_fail git push .. master:master
31
+ test_must_fail git push .. main:main
32
)
33
34
'
@@ -37,7 +37,7 @@ test_expect_success 'forced push should succeed' '
37
38
(
39
cd another &&
40
- git push .. +master:master
40
+ git push .. +main:main
41
)
42
43
'
t/t5407-post-rewrite-hook.sh
+2
-2
@@ -4,7 +4,7 @@
4
#
5
6
test_description='Test the post-rewrite hook.'
7
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
7
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
8
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
9
10
. ./test-lib.sh
@@ -17,7 +17,7 @@ test_expect_success 'setup' '
17
git checkout A^0 &&
18
test_commit E bar E &&
19
test_commit F foo F &&
20
- git checkout master
20
+ git checkout main
21
'
22
23
mkdir .git/hooks
t/t5410-receive-pack-alternates.sh
+3
-3
@@ -2,7 +2,7 @@
2
3
test_description='git receive-pack with alternate ref filtering'
4
5
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
@@ -10,9 +10,9 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10
test_expect_success 'setup' '
11
test_commit base &&
12
git clone -s --bare . fork &&
13
- git checkout -b public/branch master &&
13
+ git checkout -b public/branch main &&
14
test_commit public &&
15
- git checkout -b private/branch master &&
15
+ git checkout -b private/branch main &&
16
test_commit private
17
'
18