t55[4-9]*: adjust the references to the default branch name "main"
This trick was performed via $ (cd t && sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \ -e 's/Master/Main/g' -e 's/retsam/niam/g' \ -- t55[4-9]*.sh t556x*) This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main` for those tests. Note that t5541 uses the reversed `master` name: `retsam`. We replace it by the equivalent for `main`: `niam`. 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
028cb644ec6450fa9438ba6b6d100c0f34e029a5
19 files changed
+239
-239
t/t5540-http-push-webdav.sh
+5
-5
@@ -7,7 +7,7 @@ test_description='test WebDAV http-push
7
8
This test runs various sanity checks on http-push.'
9
10
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
10
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
11
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
12
13
. ./test-lib.sh
@@ -74,7 +74,7 @@ test_expect_success 'push already up-to-date' '
74
test_expect_success 'push to remote repository with unpacked refs' '
75
(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
76
rm packed-refs &&
77
- git update-ref refs/heads/master $ORIG_HEAD &&
77
+ git update-ref refs/heads/main $ORIG_HEAD &&
78
git --bare update-server-info) &&
79
git push &&
80
(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
@@ -94,7 +94,7 @@ test_expect_success 'http-push fetches unpacked objects' '
94
git remote rm origin &&
95
git reflog expire --expire=0 --all &&
96
git prune &&
97
- git push -f -v $HTTPD_URL/dumb/test_repo_unpacked.git master)
97
+ git push -f -v $HTTPD_URL/dumb/test_repo_unpacked.git main)
98
'
99
100
test_expect_success 'http-push fetches packed objects' '
@@ -114,7 +114,7 @@ test_expect_success 'http-push fetches packed objects' '
114
git remote remove origin &&
115
git reflog expire --expire=0 --all &&
116
git prune &&
117
- git push -f -v $HTTPD_URL/dumb/test_repo_packed.git master)
117
+ git push -f -v $HTTPD_URL/dumb/test_repo_packed.git main)
118
'
119
120
test_expect_success 'create and delete remote branch' '
@@ -166,7 +166,7 @@ test_expect_success 'PUT and MOVE sends object to URLs with SHA-1 hash suffix' '
166
'
167
168
test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
169
- "$ROOT_PATH"/test_repo_clone master
169
+ "$ROOT_PATH"/test_repo_clone main
170
171
test_expect_success 'push to password-protected repository (user in URL)' '
172
test_commit pw-user &&
t/t5541-http-push-smart.sh
+21
-21
@@ -4,7 +4,7 @@
4
#
5
6
test_description='test smart pushing over http via http-backend'
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
@@ -145,23 +145,23 @@ test_expect_success 'used receive-pack service' '
145
'
146
147
test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
148
- "$ROOT_PATH"/test_repo_clone master success
148
+ "$ROOT_PATH"/test_repo_clone main success
149
150
test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' '
151
# create a dissimilarly-named remote ref so that git is unable to match the
152
# two refs (viz. local, remote) unless an explicit refspec is provided.
153
- git push origin master:retsam &&
153
+ git push origin main:niam &&
154
155
echo "change changed" > path2 &&
156
git commit -a -m path2 --amend &&
157
158
- # push master too; this ensures there is at least one '"'push'"' command to
158
+ # push main too; this ensures there is at least one '"'push'"' command to
159
# the remote helper and triggers interaction with the helper.
160
- test_must_fail git push -v origin +master master:retsam >output 2>&1'
160
+ test_must_fail git push -v origin +main main:niam >output 2>&1'
161
162
test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: remote output' '
163
- grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *master -> master (forced update)$" output &&
164
- grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output
163
+ grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *main -> main (forced update)$" output &&
164
+ grep "^ ! \[rejected\] *main -> niam (non-fast-forward)$" output
165
'
166
167
test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: our output' '
@@ -170,7 +170,7 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he
170
'
171
172
test_expect_success 'push (chunked)' '
173
- git checkout master &&
173
+ git checkout main &&
174
test_commit commit path3 &&
175
HEAD=$(git rev-parse --verify HEAD) &&
176
test_config http.postbuffer 4 &&
@@ -180,9 +180,9 @@ test_expect_success 'push (chunked)' '
180
test $HEAD = $(git rev-parse --verify HEAD))
181
'
182
183
-## References of remote: atomic1(1) master(2) collateral(2) other(2)
184
-## References of local : atomic2(2) master(1) collateral(3) other(2) collateral1(3) atomic(1)
185
-## Atomic push : master(1) collateral(3) atomic(1)
183
+## References of remote: atomic1(1) main(2) collateral(2) other(2)
184
+## References of local : atomic2(2) main(1) collateral(3) other(2) collateral1(3) atomic(1)
185
+## Atomic push : main(1) collateral(3) atomic(1)
186
test_expect_success 'push --atomic also prevents branch creation, reports collateral' '
187
# Setup upstream repo - empty for now
188
d=$HTTPD_DOCUMENT_ROOT_PATH/atomic-branches.git &&
@@ -195,15 +195,15 @@ test_expect_success 'push --atomic also prevents branch creation, reports collat
195
test_commit atomic2 &&
196
git branch collateral &&
197
git branch other &&
198
- git push "$up" atomic1 master collateral other &&
198
+ git push "$up" atomic1 main collateral other &&
199
git tag -d atomic1 &&
200
201
# collateral is a valid push, but should be failed by atomic push
202
git checkout collateral &&
203
test_commit collateral1 &&
204
205
- # Make master incompatible with upstream to provoke atomic
206
- git checkout master &&
205
+ # Make main incompatible with upstream to provoke atomic
206
+ git checkout main &&
207
git reset --hard HEAD^ &&
208
209
# Add a new branch which should be failed by atomic push. This is a
@@ -211,7 +211,7 @@ test_expect_success 'push --atomic also prevents branch creation, reports collat
211
git branch atomic &&
212
213
# --atomic should cause entire push to be rejected
214
- test_must_fail git push --atomic "$up" master atomic collateral 2>output &&
214
+ test_must_fail git push --atomic "$up" main atomic collateral 2>output &&
215
216
# the new branch should not have been created upstream
217
test_must_fail git -C "$d" show-ref --verify refs/heads/atomic &&
@@ -219,15 +219,15 @@ test_expect_success 'push --atomic also prevents branch creation, reports collat
219
# upstream should still reflect atomic2, the last thing we pushed
220
# successfully
221
git rev-parse atomic2 >expected &&
222
- # on master...
223
- git -C "$d" rev-parse refs/heads/master >actual &&
222
+ # on main...
223
+ git -C "$d" rev-parse refs/heads/main >actual &&
224
test_cmp expected actual &&
225
# ...and collateral.
226
git -C "$d" rev-parse refs/heads/collateral >actual &&
227
test_cmp expected actual &&
228
229
# the failed refs should be indicated to the user
230
- grep "^ ! .*rejected.* master -> master" output &&
230
+ grep "^ ! .*rejected.* main -> main" output &&
231
232
# the collateral failure refs should be indicated to the user
233
grep "^ ! .*rejected.* atomic -> atomic .*atomic push failed" output &&
@@ -475,9 +475,9 @@ test_expect_success 'clone/fetch scrubs password from reflogs' '
475
test_commit prepare-for-force-fetch &&
476
git switch -c away &&
477
git fetch "$HTTPD_URL_USER_PASS/smart/test_repo.git" \
478
- +master:master &&
478
+ +main:main &&
479
# should have been scrubbed down to vanilla URL
480
- git log -g master >reflog &&
480
+ git log -g main >reflog &&
481
grep "$HTTPD_URL" reflog &&
482
! grep "$HTTPD_URL_USER_PASS" reflog
483
'
@@ -501,7 +501,7 @@ test_expect_success 'colorize errors/hints' '
501
cd "$ROOT_PATH"/test_repo_clone &&
502
test_must_fail git -c color.transport=always -c color.advice=always \
503
-c color.push=always \
504
- push origin origin/master^:master 2>act &&
504
+ push origin origin/main^:main 2>act &&
505
test_decode_color <act >decoded &&
506
test_i18ngrep "<RED>.*rejected.*<RESET>" decoded &&
507
test_i18ngrep "<RED>error: failed to push some refs" decoded &&
t/t5542-push-http-shallow.sh
+5
-5
@@ -2,7 +2,7 @@
2
3
test_description='push from/to a shallow clone over http'
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
@@ -54,12 +54,12 @@ test_expect_success 'push to shallow repo via http' '
54
(
55
cd full &&
56
commit 9 &&
57
- git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master
57
+ git push $HTTPD_URL/smart/repo.git +main:refs/remotes/top/main
58
) &&
59
(
60
cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
61
git fsck &&
62
- git log --format=%s top/master >actual &&
62
+ git log --format=%s top/main >actual &&
63
cat <<EOF >expect &&
64
9
65
4
@@ -77,11 +77,11 @@ test_expect_success 'push from shallow repo via http' '
77
git config http.receivepack true
78
) &&
79
commit 10 &&
80
- git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master &&
80
+ git push $HTTPD_URL/smart/repo.git +main:refs/remotes/top/main &&
81
(
82
cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
83
git fsck &&
84
- git log --format=%s top/master >actual &&
84
+ git log --format=%s top/main >actual &&
85
cat <<EOF >expect &&
86
10
87
4
t/t5543-atomic-push.sh
+41
-41
@@ -2,7 +2,7 @@
2
3
test_description='pushing to a repository using the atomic push option'
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
@@ -43,9 +43,9 @@ test_expect_success 'atomic push works for a single branch' '
43
test_commit one &&
44
git push --mirror up &&
45
test_commit two &&
46
- git push --atomic up master
46
+ git push --atomic up main
47
) &&
48
- test_refs master master
48
+ test_refs main main
49
'
50
51
test_expect_success 'atomic push works for two branches' '
@@ -58,9 +58,9 @@ test_expect_success 'atomic push works for two branches' '
58
test_commit two &&
59
git checkout second &&
60
test_commit three &&
61
- git push --atomic up master second
61
+ git push --atomic up main second
62
) &&
63
- test_refs master master &&
63
+ test_refs main main &&
64
test_refs second second
65
'
66
@@ -73,7 +73,7 @@ test_expect_success 'atomic push works in combination with --mirror' '
73
test_commit two &&
74
git push --atomic --mirror up
75
) &&
76
- test_refs master master &&
76
+ test_refs main main &&
77
test_refs second second
78
'
79
@@ -82,7 +82,7 @@ test_expect_success 'atomic push works in combination with --force' '
82
(
83
cd workbench &&
84
test_commit one &&
85
- git branch second master &&
85
+ git branch second main &&
86
test_commit two_a &&
87
git checkout second &&
88
test_commit two_b &&
@@ -90,36 +90,36 @@ test_expect_success 'atomic push works in combination with --force' '
90
test_commit four &&
91
git push --mirror up &&
92
# The actual test is below
93
- git checkout master &&
93
+ git checkout main &&
94
test_commit three_a &&
95
git checkout second &&
96
git reset --hard HEAD^ &&
97
- git push --force --atomic up master second
97
+ git push --force --atomic up main second
98
) &&
99
- test_refs master master &&
99
+ test_refs main main &&
100
test_refs second second
101
'
102
103
-# set up two branches where master can be pushed but second can not
103
+# set up two branches where main can be pushed but second can not
104
# (non-fast-forward). Since second can not be pushed the whole operation
105
-# will fail and leave master untouched.
105
+# will fail and leave main untouched.
106
test_expect_success 'atomic push fails if one branch fails' '
107
mk_repo_pair &&
108
(
109
cd workbench &&
110
test_commit one &&
111
- git checkout -b second master &&
111
+ git checkout -b second main &&
112
test_commit two &&
113
test_commit three &&
114
test_commit four &&
115
git push --mirror up &&
116
git reset --hard HEAD~2 &&
117
test_commit five &&
118
- git checkout master &&
118
+ git checkout main &&
119
test_commit six &&
120
test_must_fail git push --atomic --all up
121
) &&
122
- test_refs master HEAD@{7} &&
122
+ test_refs main HEAD@{7} &&
123
test_refs second HEAD@{4}
124
'
125
@@ -129,7 +129,7 @@ test_expect_success 'atomic push fails if one tag fails remotely' '
129
(
130
cd workbench &&
131
test_commit one &&
132
- git checkout -b second master &&
132
+ git checkout -b second main &&
133
test_commit two &&
134
git push --mirror up
135
) &&
@@ -142,14 +142,14 @@ test_expect_success 'atomic push fails if one tag fails remotely' '
142
# see if we can now push both branches.
143
(
144
cd workbench &&
145
- git checkout master &&
145
+ git checkout main &&
146
test_commit three &&
147
git checkout second &&
148
test_commit four &&
149
git tag test_tag &&
150
- test_must_fail git push --tags --atomic up master second
150
+ test_must_fail git push --tags --atomic up main second
151
) &&
152
- test_refs master HEAD@{3} &&
152
+ test_refs main HEAD@{3} &&
153
test_refs second HEAD@{1}
154
'
155
@@ -158,7 +158,7 @@ test_expect_success 'atomic push obeys update hook preventing a branch to be pus
158
(
159
cd workbench &&
160
test_commit one &&
161
- git checkout -b second master &&
161
+ git checkout -b second main &&
162
test_commit two &&
163
git push --mirror up
164
) &&
@@ -168,19 +168,19 @@ test_expect_success 'atomic push obeys update hook preventing a branch to be pus
168
HOOK="$HOOKDIR/update" &&
169
mkdir -p "$HOOKDIR" &&
170
write_script "$HOOK" <<-\EOF
171
- # only allow update to master from now on
172
- test "$1" = "refs/heads/master"
171
+ # only allow update to main from now on
172
+ test "$1" = "refs/heads/main"
173
EOF
174
) &&
175
(
176
cd workbench &&
177
- git checkout master &&
177
+ git checkout main &&
178
test_commit three &&
179
git checkout second &&
180
test_commit four &&
181
- test_must_fail git push --atomic up master second
181
+ test_must_fail git push --atomic up main second
182
) &&
183
- test_refs master HEAD@{3} &&
183
+ test_refs main HEAD@{3} &&
184
test_refs second HEAD@{1}
185
'
186
@@ -195,21 +195,21 @@ test_expect_success 'atomic push is not advertised if configured' '
195
test_commit one &&
196
git push --mirror up &&
197
test_commit two &&
198
- test_must_fail git push --atomic up master
198
+ test_must_fail git push --atomic up main
199
) &&
200
- test_refs master HEAD@{1}
200
+ test_refs main HEAD@{1}
201
'
202
203
-# References in upstream : master(1) one(1) foo(1)
204
-# References in workbench: master(2) foo(1) two(2) bar(2)
205
-# Atomic push : master(2) two(2) bar(2)
203
+# References in upstream : main(1) one(1) foo(1)
204
+# References in workbench: main(2) foo(1) two(2) bar(2)
205
+# Atomic push : main(2) two(2) bar(2)
206
test_expect_success 'atomic push reports (reject by update hook)' '
207
mk_repo_pair &&
208
(
209
cd workbench &&
210
test_commit one &&
211
git branch foo &&
212
- git push up master one foo &&
212
+ git push up main one foo &&
213
git tag -d one
214
) &&
215
(
@@ -231,19 +231,19 @@ test_expect_success 'atomic push reports (reject by update hook)' '
231
git branch bar
232
) &&
233
test_must_fail git -C workbench \
234
- push --atomic up master two bar >out 2>&1 &&
234
+ push --atomic up main two bar >out 2>&1 &&
235
fmt_status_report <out >actual &&
236
cat >expect <<-EOF &&
237
To ../upstream
238
- ! [remote rejected] master -> master (atomic push failure)
238
+ ! [remote rejected] main -> main (atomic push failure)
239
! [remote rejected] two -> two (atomic push failure)
240
! [remote rejected] bar -> bar (hook declined)
241
EOF
242
test_cmp expect actual
243
'
244
245
-# References in upstream : master(1) one(1) foo(1)
246
-# References in workbench: master(2) foo(1) two(2) bar(2)
245
+# References in upstream : main(1) one(1) foo(1)
246
+# References in workbench: main(2) foo(1) two(2) bar(2)
247
test_expect_success 'atomic push reports (mirror, but reject by update hook)' '
248
(
249
cd workbench &&
@@ -255,7 +255,7 @@ test_expect_success 'atomic push reports (mirror, but reject by update hook)' '
255
fmt_status_report <out >actual &&
256
cat >expect <<-EOF &&
257
To ../upstream
258
- ! [remote rejected] master -> master (atomic push failure)
258
+ ! [remote rejected] main -> main (atomic push failure)
259
! [remote rejected] one (atomic push failure)
260
! [remote rejected] bar -> bar (hook declined)
261
! [remote rejected] two -> two (atomic push failure)
@@ -263,21 +263,21 @@ test_expect_success 'atomic push reports (mirror, but reject by update hook)' '
263
test_cmp expect actual
264
'
265
266
-# References in upstream : master(2) one(1) foo(1)
267
-# References in workbench: master(1) foo(1) two(2) bar(2)
266
+# References in upstream : main(2) one(1) foo(1)
267
+# References in workbench: main(1) foo(1) two(2) bar(2)
268
test_expect_success 'atomic push reports (reject by non-ff)' '
269
rm upstream/.git/hooks/update &&
270
(
271
cd workbench &&
272
- git push up master &&
272
+ git push up main &&
273
git reset --hard HEAD^
274
) &&
275
test_must_fail git -C workbench \
276
- push --atomic up master foo bar >out 2>&1 &&
276
+ push --atomic up main foo bar >out 2>&1 &&
277
fmt_status_report <out >actual &&
278
cat >expect <<-EOF &&
279
To ../upstream
280
- ! [rejected] master -> master (non-fast-forward)
280
+ ! [rejected] main -> main (non-fast-forward)
281
! [rejected] bar -> bar (atomic push failed)
282
EOF
283
test_cmp expect actual
t/t5545-push-options.sh
+32
-32
@@ -2,7 +2,7 @@
2
3
test_description='pushing to a repository using push options'
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
@@ -66,9 +66,9 @@ test_expect_success 'one push option works for a single branch' '
66
test_commit one &&
67
git push --mirror up &&
68
test_commit two &&
69
- git push --push-option=asdf up master
69
+ git push --push-option=asdf up main
70
) &&
71
- test_refs master master &&
71
+ test_refs main main &&
72
echo "asdf" >expect &&
73
test_cmp expect upstream/.git/hooks/pre-receive.push_options &&
74
test_cmp expect upstream/.git/hooks/post-receive.push_options
@@ -82,9 +82,9 @@ test_expect_success 'push option denied by remote' '
82
test_commit one &&
83
git push --mirror up &&
84
test_commit two &&
85
- test_must_fail git push --push-option=asdf up master
85
+ test_must_fail git push --push-option=asdf up main
86
) &&
87
- test_refs master HEAD@{1}
87
+ test_refs main HEAD@{1}
88
'
89
90
test_expect_success 'two push options work' '
@@ -95,9 +95,9 @@ test_expect_success 'two push options work' '
95
test_commit one &&
96
git push --mirror up &&
97
test_commit two &&
98
- git push --push-option=asdf --push-option="more structured text" up master
98
+ git push --push-option=asdf --push-option="more structured text" up main
99
) &&
100
- test_refs master master &&
100
+ test_refs main main &&
101
printf "asdf\nmore structured text\n" >expect &&
102
test_cmp expect upstream/.git/hooks/pre-receive.push_options &&
103
test_cmp expect upstream/.git/hooks/post-receive.push_options
@@ -126,14 +126,14 @@ test_expect_success 'push options and submodules' '
126
127
git -C parent push \
128
--push-option=asdf --push-option="more structured text" \
129
- --recurse-submodules=on-demand up master &&
129
+ --recurse-submodules=on-demand up main &&
130
131
- git -C upstream rev-parse --verify master >expect &&
132
- git -C parent/workbench rev-parse --verify master >actual &&
131
+ git -C upstream rev-parse --verify main >expect &&
132
+ git -C parent/workbench rev-parse --verify main >actual &&
133
test_cmp expect actual &&
134
135
- git -C parent_upstream rev-parse --verify master >expect &&
136
- git -C parent rev-parse --verify master >actual &&
135
+ git -C parent_upstream rev-parse --verify main >expect &&
136
+ git -C parent rev-parse --verify main >actual &&
137
test_cmp expect actual &&
138
139
printf "asdf\nmore structured text\n" >expect &&
@@ -151,9 +151,9 @@ test_expect_success 'default push option' '
151
test_commit one &&
152
git push --mirror up &&
153
test_commit two &&
154
- git -c push.pushOption=default push up master
154
+ git -c push.pushOption=default push up main
155
) &&
156
- test_refs master master &&
156
+ test_refs main main &&
157
echo "default" >expect &&
158
test_cmp expect upstream/.git/hooks/pre-receive.push_options &&
159
test_cmp expect upstream/.git/hooks/post-receive.push_options
@@ -167,9 +167,9 @@ test_expect_success 'two default push options' '
167
test_commit one &&
168
git push --mirror up &&
169
test_commit two &&
170
- git -c push.pushOption=default1 -c push.pushOption=default2 push up master
170
+ git -c push.pushOption=default1 -c push.pushOption=default2 push up main
171
) &&
172
- test_refs master master &&
172
+ test_refs main main &&
173
printf "default1\ndefault2\n" >expect &&
174
test_cmp expect upstream/.git/hooks/pre-receive.push_options &&
175
test_cmp expect upstream/.git/hooks/post-receive.push_options
@@ -183,9 +183,9 @@ test_expect_success 'push option from command line overrides from-config push op
183
test_commit one &&
184
git push --mirror up &&
185
test_commit two &&
186
- git -c push.pushOption=default push --push-option=manual up master
186
+ git -c push.pushOption=default push --push-option=manual up main
187
) &&
188
- test_refs master master &&
188
+ test_refs main main &&
189
echo "manual" >expect &&
190
test_cmp expect upstream/.git/hooks/pre-receive.push_options &&
191
test_cmp expect upstream/.git/hooks/post-receive.push_options
@@ -199,9 +199,9 @@ test_expect_success 'empty value of push.pushOption in config clears the list' '
199
test_commit one &&
200
git push --mirror up &&
201
test_commit two &&
202
- git -c push.pushOption=default1 -c push.pushOption= -c push.pushOption=default2 push up master
202
+ git -c push.pushOption=default1 -c push.pushOption= -c push.pushOption=default2 push up main
203
) &&
204
- test_refs master master &&
204
+ test_refs main main &&
205
echo "default2" >expect &&
206
test_cmp expect upstream/.git/hooks/pre-receive.push_options &&
207
test_cmp expect upstream/.git/hooks/post-receive.push_options
@@ -215,16 +215,16 @@ test_expect_success 'invalid push option in config' '
215
test_commit one &&
216
git push --mirror up &&
217
test_commit two &&
218
- test_must_fail git -c push.pushOption push up master
218
+ test_must_fail git -c push.pushOption push up main
219
) &&
220
- test_refs master HEAD@{1}
220
+ test_refs main HEAD@{1}
221
'
222
223
test_expect_success 'push options keep quoted characters intact (direct)' '
224
mk_repo_pair &&
225
git -C upstream config receive.advertisePushOptions true &&
226
test_commit -C workbench one &&
227
- git -C workbench push --push-option="\"embedded quotes\"" up master &&
227
+ git -C workbench push --push-option="\"embedded quotes\"" up main &&
228
echo "\"embedded quotes\"" >expect &&
229
test_cmp expect upstream/.git/hooks/pre-receive.push_options
230
'
@@ -247,28 +247,28 @@ mk_http_pair () {
247
test_expect_success 'push option denied properly by http server' '
248
mk_http_pair false &&
249
test_commit -C test_http_clone one &&
250
- test_must_fail git -C test_http_clone push --push-option=asdf origin master 2>actual &&
250
+ test_must_fail git -C test_http_clone push --push-option=asdf origin main 2>actual &&
251
test_i18ngrep "the receiving end does not support push options" actual &&
252
- git -C test_http_clone push origin master
252
+ git -C test_http_clone push origin main
253
'
254
255
test_expect_success 'push options work properly across http' '
256
mk_http_pair true &&
257
258
test_commit -C test_http_clone one &&
259
- git -C test_http_clone push origin master &&
260
- git -C "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git rev-parse --verify master >expect &&
261
- git -C test_http_clone rev-parse --verify master >actual &&
259
+ git -C test_http_clone push origin main &&
260
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git rev-parse --verify main >expect &&
261
+ git -C test_http_clone rev-parse --verify main >actual &&
262
test_cmp expect actual &&
263
264
test_commit -C test_http_clone two &&
265
- git -C test_http_clone push --push-option=asdf --push-option="more structured text" origin master &&
265
+ git -C test_http_clone push --push-option=asdf --push-option="more structured text" origin main &&
266
printf "asdf\nmore structured text\n" >expect &&
267
test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/pre-receive.push_options &&
268
test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/post-receive.push_options &&
269
270
- git -C "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git rev-parse --verify master >expect &&
271
- git -C test_http_clone rev-parse --verify master >actual &&
270
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git rev-parse --verify main >expect &&
271
+ git -C test_http_clone rev-parse --verify main >actual &&
272
test_cmp expect actual
273
'
274
@@ -276,7 +276,7 @@ test_expect_success 'push options keep quoted characters intact (http)' '
276
mk_http_pair true &&
277
278
test_commit -C test_http_clone one &&
279
- git -C test_http_clone push --push-option="\"embedded quotes\"" origin master &&
279
+ git -C test_http_clone push --push-option="\"embedded quotes\"" origin main &&
280
echo "\"embedded quotes\"" >expect &&
281
test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/pre-receive.push_options
282
'
t/t5548-push-porcelain.sh
+32
-32
@@ -36,7 +36,7 @@ create_commits_in () {
36
shift ||
37
return 1
38
done &&
39
- git -C "$repo" update-ref refs/heads/master $oid
39
+ git -C "$repo" update-ref refs/heads/main $oid
40
}
41
42
# Format the output of git-push, git-show-ref and other commands to make a
@@ -57,8 +57,8 @@ make_user_friendly_and_stable_output () {
57
}
58
59
setup_upstream_and_workbench () {
60
- # Upstream after setup : master(B) foo(A) bar(A) baz(A)
61
- # Workbench after setup : master(A)
60
+ # Upstream after setup : main(B) foo(A) bar(A) baz(A)
61
+ # Workbench after setup : main(A)
62
test_expect_success "setup upstream repository and workbench" '
63
rm -rf upstream.git workbench &&
64
git init --bare upstream.git &&
@@ -70,9 +70,9 @@ setup_upstream_and_workbench () {
70
# this fixed-width oid will be replaced with "<OID>".
71
git config core.abbrev 7 &&
72
git remote add origin ../upstream.git &&
73
- git update-ref refs/heads/master $A &&
73
+ git update-ref refs/heads/main $A &&
74
git push origin \
75
- $B:refs/heads/master \
75
+ $B:refs/heads/main \
76
$A:refs/heads/foo \
77
$A:refs/heads/bar \
78
$A:refs/heads/baz
@@ -94,17 +94,17 @@ run_git_push_porcelain_output_test() {
94
;;
95
esac
96
97
- # Refs of upstream : master(B) foo(A) bar(A) baz(A)
98
- # Refs of workbench: master(A) baz(A) next(A)
99
- # git-push : master(A) NULL (B) baz(A) next(A)
97
+ # Refs of upstream : main(B) foo(A) bar(A) baz(A)
98
+ # Refs of workbench: main(A) baz(A) next(A)
99
+ # git-push : main(A) NULL (B) baz(A) next(A)
100
test_expect_success "porcelain output of successful git-push ($PROTOCOL)" '
101
(
102
cd workbench &&
103
- git update-ref refs/heads/master $A &&
103
+ git update-ref refs/heads/main $A &&
104
git update-ref refs/heads/baz $A &&
105
git update-ref refs/heads/next $A &&
106
git push --porcelain --force origin \
107
- master \
107
+ main \
108
:refs/heads/foo \
109
$B:bar \
110
baz \
@@ -116,7 +116,7 @@ run_git_push_porcelain_output_test() {
116
= refs/heads/baz:refs/heads/baz [up to date]
117
<COMMIT-B>:refs/heads/bar <OID-A>..<OID-B>
118
- :refs/heads/foo [deleted]
119
- + refs/heads/master:refs/heads/master <OID-B>...<OID-A> (forced update)
119
+ + refs/heads/main:refs/heads/main <OID-B>...<OID-A> (forced update)
120
* refs/heads/next:refs/heads/next [new branch]
121
Done
122
EOF
@@ -127,22 +127,22 @@ run_git_push_porcelain_output_test() {
127
cat >expect <<-EOF &&
128
<COMMIT-B> refs/heads/bar
129
<COMMIT-A> refs/heads/baz
130
- <COMMIT-A> refs/heads/master
130
+ <COMMIT-A> refs/heads/main
131
<COMMIT-A> refs/heads/next
132
EOF
133
test_cmp expect actual
134
'
135
136
- # Refs of upstream : master(A) bar(B) baz(A) next(A)
137
- # Refs of workbench: master(B) bar(A) baz(A) next(A)
138
- # git-push : master(B) bar(A) NULL next(A)
136
+ # Refs of upstream : main(A) bar(B) baz(A) next(A)
137
+ # Refs of workbench: main(B) bar(A) baz(A) next(A)
138
+ # git-push : main(B) bar(A) NULL next(A)
139
test_expect_success "atomic push failed ($PROTOCOL)" '
140
(
141
cd workbench &&
142
- git update-ref refs/heads/master $B &&
142
+ git update-ref refs/heads/main $B &&
143
git update-ref refs/heads/bar $A &&
144
test_must_fail git push --atomic --porcelain origin \
145
- master \
145
+ main \
146
bar \
147
:baz \
148
next
@@ -153,7 +153,7 @@ run_git_push_porcelain_output_test() {
153
= refs/heads/next:refs/heads/next [up to date]
154
! refs/heads/bar:refs/heads/bar [rejected] (non-fast-forward)
155
! (delete):refs/heads/baz [rejected] (atomic push failed)
156
- ! refs/heads/master:refs/heads/master [rejected] (atomic push failed)
156
+ ! refs/heads/main:refs/heads/main [rejected] (atomic push failed)
157
Done
158
EOF
159
test_cmp expect actual &&
@@ -163,7 +163,7 @@ run_git_push_porcelain_output_test() {
163
cat >expect <<-EOF &&
164
<COMMIT-B> refs/heads/bar
165
<COMMIT-A> refs/heads/baz
166
- <COMMIT-A> refs/heads/master
166
+ <COMMIT-A> refs/heads/main
167
<COMMIT-A> refs/heads/next
168
EOF
169
test_cmp expect actual
@@ -174,16 +174,16 @@ run_git_push_porcelain_output_test() {
174
EOF
175
'
176
177
- # Refs of upstream : master(A) bar(B) baz(A) next(A)
178
- # Refs of workbench: master(B) bar(A) baz(A) next(A)
179
- # git-push : master(B) bar(A) NULL next(A)
177
+ # Refs of upstream : main(A) bar(B) baz(A) next(A)
178
+ # Refs of workbench: main(B) bar(A) baz(A) next(A)
179
+ # git-push : main(B) bar(A) NULL next(A)
180
test_expect_success "pre-receive hook declined ($PROTOCOL)" '
181
(
182
cd workbench &&
183
- git update-ref refs/heads/master $B &&
183
+ git update-ref refs/heads/main $B &&
184
git update-ref refs/heads/bar $A &&
185
test_must_fail git push --porcelain --force origin \
186
- master \
186
+ main \
187
bar \
188
:baz \
189
next
@@ -194,7 +194,7 @@ run_git_push_porcelain_output_test() {
194
= refs/heads/next:refs/heads/next [up to date]
195
! refs/heads/bar:refs/heads/bar [remote rejected] (pre-receive hook declined)
196
! :refs/heads/baz [remote rejected] (pre-receive hook declined)
197
- ! refs/heads/master:refs/heads/master [remote rejected] (pre-receive hook declined)
197
+ ! refs/heads/main:refs/heads/main [remote rejected] (pre-receive hook declined)
198
Done
199
EOF
200
test_cmp expect actual &&
@@ -204,7 +204,7 @@ run_git_push_porcelain_output_test() {
204
cat >expect <<-EOF &&
205
<COMMIT-B> refs/heads/bar
206
<COMMIT-A> refs/heads/baz
207
- <COMMIT-A> refs/heads/master
207
+ <COMMIT-A> refs/heads/main
208
<COMMIT-A> refs/heads/next
209
EOF
210
test_cmp expect actual
@@ -214,14 +214,14 @@ run_git_push_porcelain_output_test() {
214
rm "$upstream/hooks/pre-receive"
215
'
216
217
- # Refs of upstream : master(A) bar(B) baz(A) next(A)
218
- # Refs of workbench: master(B) bar(A) baz(A) next(A)
219
- # git-push : master(B) bar(A) NULL next(A)
217
+ # Refs of upstream : main(A) bar(B) baz(A) next(A)
218
+ # Refs of workbench: main(B) bar(A) baz(A) next(A)
219
+ # git-push : main(B) bar(A) NULL next(A)
220
test_expect_success "non-fastforward push ($PROTOCOL)" '
221
(
222
cd workbench &&
223
test_must_fail git push --porcelain origin \
224
- master \
224
+ main \
225
bar \
226
:baz \
227
next
@@ -231,7 +231,7 @@ run_git_push_porcelain_output_test() {
231
To <URL/of/upstream.git>
232
= refs/heads/next:refs/heads/next [up to date]
233
- :refs/heads/baz [deleted]
234
- refs/heads/master:refs/heads/master <OID-A>..<OID-B>
234
+ refs/heads/main:refs/heads/main <OID-A>..<OID-B>
235
! refs/heads/bar:refs/heads/bar [rejected] (non-fast-forward)
236
Done
237
EOF
@@ -241,7 +241,7 @@ run_git_push_porcelain_output_test() {
241
make_user_friendly_and_stable_output <out >actual &&
242
cat >expect <<-EOF &&
243
<COMMIT-B> refs/heads/bar
244
- <COMMIT-B> refs/heads/master
244
+ <COMMIT-B> refs/heads/main
245
<COMMIT-A> refs/heads/next
246
EOF
247
test_cmp expect actual
t/t5550-http-fetch-dumb.sh
+11
-11
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='test dumb fetching over http via static file'
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
@@ -29,7 +29,7 @@ test_expect_success 'create http-accessible bare repository with loose objects'
29
hooks/post-update
30
) &&
31
git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
32
- git push public master:master
32
+ git push public main:main
33
'
34
35
test_expect_success 'clone http repository' '
@@ -40,8 +40,8 @@ test_expect_success 'clone http repository' '
40
41
test_expect_success 'list refs from outside any repository' '
42
cat >expect <<-EOF &&
43
- $(git rev-parse master) HEAD
44
- $(git rev-parse master) refs/heads/master
43
+ $(git rev-parse main) HEAD
44
+ $(git rev-parse main) refs/heads/main
45
EOF
46
nongit git ls-remote "$HTTPD_URL/dumb/repo.git" >actual &&
47
test_cmp expect actual
@@ -184,8 +184,8 @@ test_expect_success 'fetch changes via manual http-fetch' '
184
185
HEAD=$(git rev-parse --verify HEAD) &&
186
(cd clone2 &&
187
- git http-fetch -a -w heads/master-new $HEAD $(git config remote.origin.url) &&
188
- git checkout master-new &&
187
+ git http-fetch -a -w heads/main-new $HEAD $(git config remote.origin.url) &&
188
+ git checkout main-new &&
189
test $HEAD = $(git rev-parse --verify HEAD)) &&
190
test_cmp file clone2/file
191
'
@@ -195,19 +195,19 @@ test_expect_success 'manual http-fetch without -a works just as well' '
195
196
HEAD=$(git rev-parse --verify HEAD) &&
197
(cd clone3 &&
198
- git http-fetch -w heads/master-new $HEAD $(git config remote.origin.url) &&
199
- git checkout master-new &&
198
+ git http-fetch -w heads/main-new $HEAD $(git config remote.origin.url) &&
199
+ git checkout main-new &&
200
test $HEAD = $(git rev-parse --verify HEAD)) &&
201
test_cmp file clone3/file
202
'
203
204
test_expect_success 'http remote detects correct HEAD' '
205
- git push public master:other &&
205
+ git push public main:other &&
206
(cd clone &&
207
git remote set-head origin -d &&
208
git remote set-head origin -a &&
209
git symbolic-ref refs/remotes/origin/HEAD > output &&
210
- echo refs/remotes/origin/master > expect &&
210
+ echo refs/remotes/origin/main > expect &&
211
test_cmp expect output
212
)
213
'
@@ -419,7 +419,7 @@ test_expect_success 'set up evil alternates scheme' '
419
evil=$HTTPD_DOCUMENT_ROOT_PATH/evil.git &&
420
git init --bare "$evil" &&
421
# do this by hand to avoid object existence check
422
- printf "%s\\t%s\\n" $sha1 refs/heads/master >"$evil/info/refs"
422
+ printf "%s\\t%s\\n" $sha1 refs/heads/main >"$evil/info/refs"
423
'
424
425
# Here we'll just redirect via HTTP. In a real-world attack these would be on
t/t5551-http-fetch-smart.sh
+11
-11
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='test smart fetching over http via http-backend'
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 'create http-accessible bare repository' '
21
git --bare init
22
) &&
23
git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
24
- git push public master:master
24
+ git push public main:main
25
'
26
27
setup_askpass_helper
@@ -241,9 +241,9 @@ test_expect_success 'invalid Content-Type rejected' '
241
242
test_expect_success 'create namespaced refs' '
243
test_commit namespaced &&
244
- git push public HEAD:refs/namespaces/ns/refs/heads/master &&
244
+ git push public HEAD:refs/namespaces/ns/refs/heads/main &&
245
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
246
- symbolic-ref refs/namespaces/ns/HEAD refs/namespaces/ns/refs/heads/master
246
+ symbolic-ref refs/namespaces/ns/HEAD refs/namespaces/ns/refs/heads/main
247
'
248
249
test_expect_success 'smart clone respects namespace' '
@@ -274,7 +274,7 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set
274
EOF
275
git config http.cookiefile cookies.txt &&
276
git config http.savecookies true &&
277
- git ls-remote $HTTPD_URL/smart_cookies/repo.git master &&
277
+ git ls-remote $HTTPD_URL/smart_cookies/repo.git main &&
278
279
# NEEDSWORK: If the overspecification of the expected result is reduced, we
280
# might be able to run this test in all protocol versions.
@@ -347,12 +347,12 @@ test_expect_success 'large fetch-pack requests can be sent using chunked encodin
347
test_expect_success 'test allowreachablesha1inwant' '
348
test_when_finished "rm -rf test_reachable.git" &&
349
server="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
350
- master_sha=$(git -C "$server" rev-parse refs/heads/master) &&
350
+ main_sha=$(git -C "$server" rev-parse refs/heads/main) &&
351
git -C "$server" config uploadpack.allowreachablesha1inwant 1 &&
352
353
git init --bare test_reachable.git &&
354
git -C test_reachable.git remote add origin "$HTTPD_URL/smart/repo.git" &&
355
- git -C test_reachable.git fetch origin "$master_sha"
355
+ git -C test_reachable.git fetch origin "$main_sha"
356
'
357
358
test_expect_success 'test allowreachablesha1inwant with unreachable' '
@@ -366,7 +366,7 @@ test_expect_success 'test allowreachablesha1inwant with unreachable' '
366
git push public :refs/heads/doomed &&
367
368
server="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
369
- master_sha=$(git -C "$server" rev-parse refs/heads/master) &&
369
+ main_sha=$(git -C "$server" rev-parse refs/heads/main) &&
370
git -C "$server" config uploadpack.allowreachablesha1inwant 1 &&
371
372
git init --bare test_reachable.git &&
@@ -388,7 +388,7 @@ test_expect_success 'test allowanysha1inwant with unreachable' '
388
git push public :refs/heads/doomed &&
389
390
server="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
391
- master_sha=$(git -C "$server" rev-parse refs/heads/master) &&
391
+ main_sha=$(git -C "$server" rev-parse refs/heads/main) &&
392
git -C "$server" config uploadpack.allowreachablesha1inwant 1 &&
393
394
git init --bare test_reachable.git &&
@@ -447,8 +447,8 @@ test_expect_success 'using fetch command in remote-curl updates refs' '
447
test_commit -C "$SERVER" bar &&
448
git -C client -c protocol.version=0 fetch &&
449
450
- git -C "$SERVER" rev-parse master >expect &&
451
- git -C client rev-parse origin/master >actual &&
450
+ git -C "$SERVER" rev-parse main >expect &&
451
+ git -C client rev-parse origin/main >actual &&
452
test_cmp expect actual
453
'
454
t/t5552-skipping-fetch-negotiator.sh
+1
-1
@@ -100,7 +100,7 @@ test_expect_success 'use ref advertisement to filter out commits' '
100
git -C server checkout --orphan anotherbranch &&
101
test_commit -C server to_fetch &&
102
103
- # The server advertising "c3" (as "refs/heads/master") means that we do
103
+ # The server advertising "c3" (as "refs/heads/main") means that we do
104
# not need to send any ancestors of "c3", but we still need to send "c3"
105
# itself.
106
test_config -C client fetch.negotiationalgorithm skipping &&
t/t5553-set-upstream.sh
+42
-42
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='"git fetch/pull --set-upstream" basic tests.'
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
@@ -35,9 +35,9 @@ test_expect_success 'setup bare parent fetch' '
35
git remote add upstream parent
36
'
37
38
-test_expect_success 'setup commit on master and other fetch' '
38
+test_expect_success 'setup commit on main and other fetch' '
39
test_commit one &&
40
- git push upstream master &&
40
+ git push upstream main &&
41
git checkout -b other &&
42
test_commit two &&
43
git push upstream other
@@ -46,38 +46,38 @@ test_expect_success 'setup commit on master and other fetch' '
46
# tests for fetch --set-upstream
47
48
test_expect_success 'fetch --set-upstream does not set upstream w/o branch' '
49
- clear_config master other &&
50
- git checkout master &&
49
+ clear_config main other &&
50
+ git checkout main &&
51
git fetch --set-upstream upstream &&
52
- check_config_missing master &&
52
+ check_config_missing main &&
53
check_config_missing other
54
'
55
56
-test_expect_success 'fetch --set-upstream upstream master sets branch master but not other' '
57
- clear_config master other &&
58
- git fetch --set-upstream upstream master &&
59
- check_config master upstream refs/heads/master &&
56
+test_expect_success 'fetch --set-upstream upstream main sets branch main but not other' '
57
+ clear_config main other &&
58
+ git fetch --set-upstream upstream main &&
59
+ check_config main upstream refs/heads/main &&
60
check_config_missing other
61
'
62
63
test_expect_success 'fetch --set-upstream upstream other sets branch other' '
64
- clear_config master other &&
64
+ clear_config main other &&
65
git fetch --set-upstream upstream other &&
66
- check_config master upstream refs/heads/other &&
66
+ check_config main upstream refs/heads/other &&
67
check_config_missing other
68
'
69
70
-test_expect_success 'fetch --set-upstream master:other does not set the branch other2' '
70
+test_expect_success 'fetch --set-upstream main:other does not set the branch other2' '
71
clear_config other2 &&
72
- git fetch --set-upstream upstream master:other2 &&
72
+ git fetch --set-upstream upstream main:other2 &&
73
check_config_missing other2
74
'
75
76
test_expect_success 'fetch --set-upstream http://nosuchdomain.example.com fails with invalid url' '
77
- # master explicitly not cleared, we check that it is not touched from previous value
77
+ # main explicitly not cleared, we check that it is not touched from previous value
78
clear_config other other2 &&
79
test_must_fail git fetch --set-upstream http://nosuchdomain.example.com &&
80
- check_config master upstream refs/heads/other &&
80
+ check_config main upstream refs/heads/other &&
81
check_config_missing other &&
82
check_config_missing other2
83
'
@@ -86,7 +86,7 @@ test_expect_success 'fetch --set-upstream with valid URL sets upstream to URL' '
86
clear_config other other2 &&
87
url="file://$PWD" &&
88
git fetch --set-upstream "$url" &&
89
- check_config master "$url" HEAD &&
89
+ check_config main "$url" HEAD &&
90
check_config_missing other &&
91
check_config_missing other2
92
'
@@ -99,30 +99,30 @@ test_expect_success 'setup bare parent pull' '
99
git remote add upstream parent
100
'
101
102
-test_expect_success 'setup commit on master and other pull' '
102
+test_expect_success 'setup commit on main and other pull' '
103
test_commit three &&
104
- git push --tags upstream master &&
104
+ git push --tags upstream main &&
105
test_commit four &&
106
git push upstream other
107
'
108
109
-test_expect_success 'pull --set-upstream upstream master sets branch master but not other' '
110
- clear_config master other &&
111
- git pull --set-upstream upstream master &&
112
- check_config master upstream refs/heads/master &&
109
+test_expect_success 'pull --set-upstream upstream main sets branch main but not other' '
110
+ clear_config main other &&
111
+ git pull --set-upstream upstream main &&
112
+ check_config main upstream refs/heads/main &&
113
check_config_missing other
114
'
115
116
-test_expect_success 'pull --set-upstream master:other2 does not set the branch other2' '
116
+test_expect_success 'pull --set-upstream main:other2 does not set the branch other2' '
117
clear_config other2 &&
118
- git pull --set-upstream upstream master:other2 &&
118
+ git pull --set-upstream upstream main:other2 &&
119
check_config_missing other2
120
'
121
122
-test_expect_success 'pull --set-upstream upstream other sets branch master' '
123
- clear_config master other &&
122
+test_expect_success 'pull --set-upstream upstream other sets branch main' '
123
+ clear_config main other &&
124
git pull --set-upstream upstream other &&
125
- check_config master upstream refs/heads/other &&
125
+ check_config main upstream refs/heads/other &&
126
check_config_missing other
127
'
128
@@ -133,47 +133,47 @@ test_expect_success 'pull --set-upstream upstream tag does not set the tag' '
133
'
134
135
test_expect_success 'pull --set-upstream http://nosuchdomain.example.com fails with invalid url' '
136
- # master explicitly not cleared, we check that it is not touched from previous value
136
+ # main explicitly not cleared, we check that it is not touched from previous value
137
clear_config other other2 three &&
138
test_must_fail git pull --set-upstream http://nosuchdomain.example.com &&
139
- check_config master upstream refs/heads/other &&
139
+ check_config main upstream refs/heads/other &&
140
check_config_missing other &&
141
check_config_missing other2 &&
142
check_config_missing three
143
'
144
145
test_expect_success 'pull --set-upstream upstream HEAD sets branch HEAD' '
146
- clear_config master other &&
146
+ clear_config main other &&
147
git pull --set-upstream upstream HEAD &&
148
- check_config master upstream HEAD &&
148
+ check_config main upstream HEAD &&
149
git checkout other &&
150
git pull --set-upstream upstream HEAD &&
151
check_config other upstream HEAD
152
'
153
154
test_expect_success 'pull --set-upstream upstream with more than one branch does nothing' '
155
- clear_config master three &&
156
- git pull --set-upstream upstream master three &&
157
- check_config_missing master &&
155
+ clear_config main three &&
156
+ git pull --set-upstream upstream main three &&
157
+ check_config_missing main &&
158
check_config_missing three
159
'
160
161
test_expect_success 'pull --set-upstream with valid URL sets upstream to URL' '
162
- clear_config master other other2 &&
163
- git checkout master &&
162
+ clear_config main other other2 &&
163
+ git checkout main &&
164
url="file://$PWD" &&
165
git pull --set-upstream "$url" &&
166
- check_config master "$url" HEAD &&
166
+ check_config main "$url" HEAD &&
167
check_config_missing other &&
168
check_config_missing other2
169
'
170
171
test_expect_success 'pull --set-upstream with valid URL and branch sets branch' '
172
- clear_config master other other2 &&
173
- git checkout master &&
172
+ clear_config main other other2 &&
173
+ git checkout main &&
174
url="file://$PWD" &&
175
- git pull --set-upstream "$url" master &&
176
- check_config master "$url" refs/heads/master &&
175
+ git pull --set-upstream "$url" main &&
176
+ check_config main "$url" refs/heads/main &&
177
check_config_missing other &&
178
check_config_missing other2
179
'
t/t5560-http-backend-noserver.sh
+1
-1
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='test git-http-backend-noserver'
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
t/t5561-http-backend.sh
+3
-3
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='test git-http-backend'
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
@@ -42,9 +42,9 @@ POST() {
42
43
grep '^[^#]' >exp <<EOF
44
45
-### refs/heads/master
45
+### refs/heads/main
46
###
47
-GET /smart/repo.git/refs/heads/master HTTP/1.1 404 -
47
+GET /smart/repo.git/refs/heads/main HTTP/1.1 404 -
48
49
### getanyfile default
50
###
t/t556x_common
+4
-4
@@ -22,7 +22,7 @@ test_expect_success 'setup repository' '
22
: >objects/info/http-alternates
23
) &&
24
git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
25
- git push public master:master &&
25
+ git push public main:main &&
26
27
(cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
28
git repack -a -d
@@ -31,7 +31,7 @@ test_expect_success 'setup repository' '
31
echo other >file &&
32
git add file &&
33
git commit -m two &&
34
- git push public master:master &&
34
+ git push public main:main &&
35
36
LOOSE_URL=$(find_file objects/??) &&
37
PACK_URL=$(find_file objects/pack/*.pack) &&
@@ -51,8 +51,8 @@ get_static_files() {
51
52
SMART=smart
53
GIT_HTTP_EXPORT_ALL=1 && export GIT_HTTP_EXPORT_ALL
54
-test_expect_success 'direct refs/heads/master not found' '
55
- GET refs/heads/master "404 Not Found"
54
+test_expect_success 'direct refs/heads/main not found' '
55
+ GET refs/heads/main "404 Not Found"
56
'
57
test_expect_success 'static file is ok' '
58
get_static_files "200 OK"
t/t5570-git-daemon.sh
+9
-9
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='test fetching over git protocol'
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
@@ -29,7 +29,7 @@ test_expect_success 'create git-accessible bare repository' '
29
: >git-daemon-export-ok
30
) &&
31
git remote add public "$GIT_DAEMON_DOCUMENT_ROOT_PATH/repo.git" &&
32
- git push public master:master
32
+ git push public main:main
33
'
34
35
test_expect_success 'clone git repository' '
@@ -58,12 +58,12 @@ test_expect_success 'no-op fetch without "-v" is quiet' '
58
'
59
60
test_expect_success 'remote detects correct HEAD' '
61
- git push public master:other &&
61
+ git push public main:other &&
62
(cd clone &&
63
git remote set-head -d origin &&
64
git remote set-head -a origin &&
65
git symbolic-ref refs/remotes/origin/HEAD > output &&
66
- echo refs/remotes/origin/master > expect &&
66
+ echo refs/remotes/origin/main > expect &&
67
test_cmp expect output
68
)
69
'
@@ -151,7 +151,7 @@ test_remote_error()
151
152
msg="access denied or repository not exported"
153
test_expect_success 'clone non-existent' "test_remote_error '$msg' clone nowhere.git"
154
-test_expect_success 'push disabled' "test_remote_error '$msg' push repo.git master"
154
+test_expect_success 'push disabled' "test_remote_error '$msg' push repo.git main"
155
test_expect_success 'read access denied' "test_remote_error -x '$msg' fetch repo.git"
156
test_expect_success 'not exported' "test_remote_error -n '$msg' fetch repo.git"
157
@@ -159,7 +159,7 @@ stop_git_daemon
159
start_git_daemon --informative-errors
160
161
test_expect_success 'clone non-existent' "test_remote_error 'no such repository' clone nowhere.git"
162
-test_expect_success 'push disabled' "test_remote_error 'service not enabled' push repo.git master"
162
+test_expect_success 'push disabled' "test_remote_error 'service not enabled' push repo.git main"
163
test_expect_success 'read access denied' "test_remote_error -x 'no such repository' fetch repo.git"
164
test_expect_success 'not exported' "test_remote_error -n 'repository not exported' fetch repo.git"
165
@@ -195,10 +195,10 @@ test_expect_success FAKENC 'hostname interpolation works after LF-stripping' '
195
fake_nc "$GIT_DAEMON_HOST_PORT" <input >output &&
196
depacketize <output >output.raw &&
197
198
- # just pick out the value of master, which avoids any protocol
198
+ # just pick out the value of main, which avoids any protocol
199
# particulars
200
- perl -lne "print \$1 if m{^(\\S+) refs/heads/master}" <output.raw >actual &&
201
- git -C "$repo" rev-parse master >expect &&
200
+ perl -lne "print \$1 if m{^(\\S+) refs/heads/main}" <output.raw >actual &&
201
+ git -C "$repo" rev-parse main >expect &&
202
test_cmp expect actual
203
'
204
t/t5571-pre-push-hook.sh
+3
-3
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='check pre-push hooks'
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
@@ -51,11 +51,11 @@ EOF
51
cat >expected <<EOF
52
parent1
53
repo1
54
-refs/heads/master $COMMIT2 refs/heads/foreign $COMMIT1
54
+refs/heads/main $COMMIT2 refs/heads/foreign $COMMIT1
55
EOF
56
57
test_expect_success 'push with hook' '
58
- git push parent1 master:foreign &&
58
+ git push parent1 main:foreign &&
59
diff expected actual
60
'
61
t/t5572-pull-submodule.sh
+2
-2
@@ -148,8 +148,8 @@ test_expect_success 'branch has no merge base with remote-tracking counterpart'
148
149
git clone parent child &&
150
151
- # Reset master so that it has no merge base with
152
- # refs/remotes/origin/master.
151
+ # Reset main so that it has no merge base with
152
+ # refs/remotes/origin/main.
153
OTHER=$(git -C child commit-tree -m bar \
154
$(git -C child rev-parse HEAD^{tree})) &&
155
git -C child reset --hard "$OTHER" &&
t/t5580-unc-paths.sh
+2
-2
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='various Windows-only path tests'
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
@@ -56,7 +56,7 @@ test_expect_success fetch '
56
git init to-fetch &&
57
(
58
cd to-fetch &&
59
- git fetch "$UNCPATH" master
59
+ git fetch "$UNCPATH" main
60
)
61
'
62
t/t5581-http-curl-verbose.sh
+2
-2
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='test GIT_CURL_VERBOSE'
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
@@ -16,7 +16,7 @@ test_expect_success 'setup repository' '
16
git add file &&
17
git commit -m one &&
18
git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
19
- git push public master:master
19
+ git push public main:main
20
'
21
22
test_expect_success 'failure in git-upload-pack is shown' '
t/t5582-fetch-negative-refspec.sh
+12
-12
@@ -5,7 +5,7 @@ test_description='"git fetch" with negative refspecs.
5
6
'
7
8
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
8
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
9
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10
11
. ./test-lib.sh
@@ -25,12 +25,12 @@ test_expect_success "clone and setup child repos" '
25
git switch -c alternate &&
26
echo >file updated again by one &&
27
git commit -a -m "updated by one again" &&
28
- git switch master
28
+ git switch main
29
) &&
30
git clone . two &&
31
(
32
cd two &&
33
- git config branch.master.remote one &&
33
+ git config branch.main.remote one &&
34
git config remote.one.url ../one/.git/ &&
35
git config remote.one.fetch +refs/heads/*:refs/remotes/one/* &&
36
git config --add remote.one.fetch ^refs/heads/alternate
@@ -46,9 +46,9 @@ test_expect_success "fetch one" '
46
test_must_fail git rev-parse --verify refs/remotes/one/alternate &&
47
git fetch one &&
48
test_must_fail git rev-parse --verify refs/remotes/one/alternate &&
49
- git rev-parse --verify refs/remotes/one/master &&
50
- mine=$(git rev-parse refs/remotes/one/master) &&
51
- his=$(cd ../one && git rev-parse refs/heads/master) &&
49
+ git rev-parse --verify refs/remotes/one/main &&
50
+ mine=$(git rev-parse refs/remotes/one/main) &&
51
+ his=$(cd ../one && git rev-parse refs/heads/main) &&
52
test "z$mine" = "z$his"
53
)
54
'
@@ -60,7 +60,7 @@ test_expect_success "fetch with negative refspec on commandline" '
60
cd three &&
61
alternate_in_one=$(cd ../one && git rev-parse refs/heads/alternate) &&
62
echo $alternate_in_one >expect &&
63
- git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^refs/heads/master &&
63
+ git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^refs/heads/main &&
64
cut -f -1 .git/FETCH_HEAD >actual &&
65
test_cmp expect actual
66
)
@@ -71,8 +71,8 @@ test_expect_success "fetch with negative sha1 refspec fails" '
71
git commit -a -m "updated by origin yet again" &&
72
(
73
cd three &&
74
- master_in_one=$(cd ../one && git rev-parse refs/heads/master) &&
75
- test_must_fail git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^$master_in_one
74
+ main_in_one=$(cd ../one && git rev-parse refs/heads/main) &&
75
+ test_must_fail git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^$main_in_one
76
)
77
'
78
@@ -95,10 +95,10 @@ test_expect_success "fetch with negative pattern refspec does not expand prefix"
95
(
96
cd three &&
97
alternate_in_one=$(cd ../one && git rev-parse refs/heads/alternate) &&
98
- master_in_one=$(cd ../one && git rev-parse refs/heads/master) &&
98
+ main_in_one=$(cd ../one && git rev-parse refs/heads/main) &&
99
echo $alternate_in_one >expect &&
100
- echo $master_in_one >>expect &&
101
- git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^master &&
100
+ echo $main_in_one >>expect &&
101
+ git fetch ../one/.git refs/heads/*:refs/remotes/one/* ^main &&
102
cut -f -1 .git/FETCH_HEAD >actual &&
103
test_cmp expect actual
104
)