@@ -8,6 +8,7 @@ test_expect_success 'make commits' '
8
8
echo content >file &&
9
9
git add file &&
10
10
git commit -m one &&
11
+ git branch -M main &&
11
12
echo content >>file &&
12
13
git commit -a -m two
13
14
'
@@ -26,7 +27,7 @@ test_expect_success 'make remote branches' '
26
27
cat > expect << 'EOF '
27
28
branch-one
28
29
branch-two
29
- * master
30
+ * main
30
31
EOF
31
32
test_expect_success ' git branch shows local branches' '
32
33
git branch >actual &&
@@ -60,7 +61,7 @@ test_expect_success 'git branch -r shows remote branches' '
60
61
cat > expect << 'EOF '
61
62
branch-one
62
63
branch-two
63
- * master
64
+ * main
64
65
remotes/origin/HEAD -> origin/branch-one
65
66
remotes/origin/branch-one
66
67
remotes/origin/branch-two
@@ -152,20 +153,20 @@ test_expect_success 'git branch shows detached HEAD properly' '
152
153
* (HEAD detached at $(git rev-parse --short HEAD^0))
153
154
branch-one
154
155
branch-two
155
- master
156
+ main
156
157
EOF
157
158
git checkout HEAD^0 &&
158
159
git branch >actual &&
159
160
test_i18ncmp expect actual
160
161
'
161
162
162
163
test_expect_success ' git branch shows detached HEAD properly after checkout --detach' '
163
- git checkout master &&
164
+ git checkout main &&
164
165
cat >expect <<EOF &&
165
166
* (HEAD detached at $(git rev-parse --short HEAD^0))
166
167
branch-one
167
168
branch-two
168
- master
169
+ main
169
170
EOF
170
171
git checkout --detach &&
171
172
git branch >actual &&
@@ -177,7 +178,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving' '
177
178
* (HEAD detached from $(git rev-parse --short HEAD))
178
179
branch-one
179
180
branch-two
180
- master
181
+ main
181
182
EOF
182
183
git reset --hard HEAD^1 &&
183
184
git branch >actual &&
@@ -189,9 +190,9 @@ test_expect_success 'git branch shows detached HEAD properly from tag' '
189
190
* (HEAD detached at fromtag)
190
191
branch-one
191
192
branch-two
192
- master
193
+ main
193
194
EOF
194
- git tag fromtag master &&
195
+ git tag fromtag main &&
195
196
git checkout fromtag &&
196
197
git branch >actual &&
197
198
test_i18ncmp expect actual
@@ -202,7 +203,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving from t
202
203
* (HEAD detached from fromtag)
203
204
branch-one
204
205
branch-two
205
- master
206
+ main
206
207
EOF
207
208
git reset --hard HEAD^1 &&
208
209
git branch >actual &&
@@ -214,7 +215,7 @@ test_expect_success 'git branch `--sort` option' '
214
215
* (HEAD detached from fromtag)
215
216
branch-two
216
217
branch-one
217
- master
218
+ main
218
219
EOF
219
220
git branch --sort=objectsize >actual &&
220
221
test_i18ncmp expect actual
@@ -223,7 +224,7 @@ test_expect_success 'git branch `--sort` option' '
223
224
test_expect_success ' git branch --points-at option' '
224
225
cat >expect <<-\EOF &&
225
226
branch-one
226
- master
227
+ main
227
228
EOF
228
229
git branch --points-at=branch-one >actual &&
229
230
test_cmp expect actual
@@ -251,7 +252,7 @@ test_expect_success 'local-branch symrefs shortened properly' '
251
252
252
253
test_expect_success ' sort branches, ignore case' '
253
254
(
254
- git init sort-icase &&
255
+ git init -b main sort-icase &&
255
256
cd sort-icase &&
256
257
test_commit initial &&
257
258
git branch branch-one &&
@@ -260,14 +261,14 @@ test_expect_success 'sort branches, ignore case' '
260
261
cat >expected <<-\EOF &&
261
262
BRANCH-two
262
263
branch-one
263
- master
264
+ main
264
265
EOF
265
266
test_cmp expected actual &&
266
267
git branch --list -i | awk "{print \$NF}" >actual &&
267
268
cat >expected <<-\EOF &&
268
269
branch-one
269
270
BRANCH-two
270
- master
271
+ main
271
272
EOF
272
273
test_cmp expected actual
273
274
)
@@ -279,7 +280,7 @@ test_expect_success 'git branch --format option' '
279
280
Refname is refs/heads/ambiguous
280
281
Refname is refs/heads/branch-one
281
282
Refname is refs/heads/branch-two
282
- Refname is refs/heads/master
283
+ Refname is refs/heads/main
283
284
Refname is refs/heads/ref-to-branch
284
285
Refname is refs/heads/ref-to-remote
285
286
EOF
@@ -293,7 +294,7 @@ test_expect_success 'worktree colors correct' '
293
294
ambiguous<RESET>
294
295
branch-one<RESET>
295
296
+ <CYAN>branch-two<RESET>
296
- master <RESET>
297
+ main <RESET>
297
298
ref-to-branch<RESET> -> branch-one
298
299
ref-to-remote<RESET> -> origin/branch-one
299
300
EOF
@@ -306,9 +307,9 @@ test_expect_success 'worktree colors correct' '
306
307
'
307
308
308
309
test_expect_success " set up color tests" '
309
- echo "<RED>master <RESET>" >expect.color &&
310
- echo "master " >expect.bare &&
311
- color_args="--format=%(color:red)%(refname:short) --list master "
310
+ echo "<RED>main <RESET>" >expect.color &&
311
+ echo "main " >expect.bare &&
312
+ color_args="--format=%(color:red)%(refname:short) --list main "
312
313
'
313
314
314
315
test_expect_success ' %(color) omitted without tty' '
@@ -329,9 +330,9 @@ test_expect_success '--color overrides auto-color' '
329
330
test_cmp expect.color actual
330
331
'
331
332
332
- test_expect_success PREPARE_FOR_MAIN_BRANCH ' verbose output lists worktree path' '
333
+ test_expect_success ' verbose output lists worktree path' '
333
334
one=$(git rev-parse --short HEAD) &&
334
- two=$(git rev-parse --short master ) &&
335
+ two=$(git rev-parse --short main ) &&
335
336
cat >expect <<-EOF &&
336
337
* (HEAD detached from fromtag) $one one
337
338
ambiguous $one one
0 commit comments