Skip to content

Commit 1eee0a4

Browse files
dschogitster
authored andcommitted
t3203: complete the transition to using the branch name main
In 66713e8 (tests: prepare aligned mentions of the default branch name, 2020-10-23), we started that transition, trying to prepare for a time when `git init` would use that name for the initial branch. Even if that time has not arrived, we can complete the transition by making the test script independent of the default branch name. This also allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq from one test case. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 94287e7 commit 1eee0a4

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

t/t3203-branch-output.sh

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test_expect_success 'make commits' '
88
echo content >file &&
99
git add file &&
1010
git commit -m one &&
11+
git branch -M main &&
1112
echo content >>file &&
1213
git commit -a -m two
1314
'
@@ -26,7 +27,7 @@ test_expect_success 'make remote branches' '
2627
cat >expect <<'EOF'
2728
branch-one
2829
branch-two
29-
* master
30+
* main
3031
EOF
3132
test_expect_success 'git branch shows local branches' '
3233
git branch >actual &&
@@ -60,7 +61,7 @@ test_expect_success 'git branch -r shows remote branches' '
6061
cat >expect <<'EOF'
6162
branch-one
6263
branch-two
63-
* master
64+
* main
6465
remotes/origin/HEAD -> origin/branch-one
6566
remotes/origin/branch-one
6667
remotes/origin/branch-two
@@ -152,20 +153,20 @@ test_expect_success 'git branch shows detached HEAD properly' '
152153
* (HEAD detached at $(git rev-parse --short HEAD^0))
153154
branch-one
154155
branch-two
155-
master
156+
main
156157
EOF
157158
git checkout HEAD^0 &&
158159
git branch >actual &&
159160
test_i18ncmp expect actual
160161
'
161162

162163
test_expect_success 'git branch shows detached HEAD properly after checkout --detach' '
163-
git checkout master &&
164+
git checkout main &&
164165
cat >expect <<EOF &&
165166
* (HEAD detached at $(git rev-parse --short HEAD^0))
166167
branch-one
167168
branch-two
168-
master
169+
main
169170
EOF
170171
git checkout --detach &&
171172
git branch >actual &&
@@ -177,7 +178,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving' '
177178
* (HEAD detached from $(git rev-parse --short HEAD))
178179
branch-one
179180
branch-two
180-
master
181+
main
181182
EOF
182183
git reset --hard HEAD^1 &&
183184
git branch >actual &&
@@ -189,9 +190,9 @@ test_expect_success 'git branch shows detached HEAD properly from tag' '
189190
* (HEAD detached at fromtag)
190191
branch-one
191192
branch-two
192-
master
193+
main
193194
EOF
194-
git tag fromtag master &&
195+
git tag fromtag main &&
195196
git checkout fromtag &&
196197
git branch >actual &&
197198
test_i18ncmp expect actual
@@ -202,7 +203,7 @@ test_expect_success 'git branch shows detached HEAD properly after moving from t
202203
* (HEAD detached from fromtag)
203204
branch-one
204205
branch-two
205-
master
206+
main
206207
EOF
207208
git reset --hard HEAD^1 &&
208209
git branch >actual &&
@@ -214,7 +215,7 @@ test_expect_success 'git branch `--sort` option' '
214215
* (HEAD detached from fromtag)
215216
branch-two
216217
branch-one
217-
master
218+
main
218219
EOF
219220
git branch --sort=objectsize >actual &&
220221
test_i18ncmp expect actual
@@ -223,7 +224,7 @@ test_expect_success 'git branch `--sort` option' '
223224
test_expect_success 'git branch --points-at option' '
224225
cat >expect <<-\EOF &&
225226
branch-one
226-
master
227+
main
227228
EOF
228229
git branch --points-at=branch-one >actual &&
229230
test_cmp expect actual
@@ -251,7 +252,7 @@ test_expect_success 'local-branch symrefs shortened properly' '
251252

252253
test_expect_success 'sort branches, ignore case' '
253254
(
254-
git init sort-icase &&
255+
git init -b main sort-icase &&
255256
cd sort-icase &&
256257
test_commit initial &&
257258
git branch branch-one &&
@@ -260,14 +261,14 @@ test_expect_success 'sort branches, ignore case' '
260261
cat >expected <<-\EOF &&
261262
BRANCH-two
262263
branch-one
263-
master
264+
main
264265
EOF
265266
test_cmp expected actual &&
266267
git branch --list -i | awk "{print \$NF}" >actual &&
267268
cat >expected <<-\EOF &&
268269
branch-one
269270
BRANCH-two
270-
master
271+
main
271272
EOF
272273
test_cmp expected actual
273274
)
@@ -279,7 +280,7 @@ test_expect_success 'git branch --format option' '
279280
Refname is refs/heads/ambiguous
280281
Refname is refs/heads/branch-one
281282
Refname is refs/heads/branch-two
282-
Refname is refs/heads/master
283+
Refname is refs/heads/main
283284
Refname is refs/heads/ref-to-branch
284285
Refname is refs/heads/ref-to-remote
285286
EOF
@@ -293,7 +294,7 @@ test_expect_success 'worktree colors correct' '
293294
ambiguous<RESET>
294295
branch-one<RESET>
295296
+ <CYAN>branch-two<RESET>
296-
master<RESET>
297+
main<RESET>
297298
ref-to-branch<RESET> -> branch-one
298299
ref-to-remote<RESET> -> origin/branch-one
299300
EOF
@@ -306,9 +307,9 @@ test_expect_success 'worktree colors correct' '
306307
'
307308

308309
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"
312313
'
313314

314315
test_expect_success '%(color) omitted without tty' '
@@ -329,9 +330,9 @@ test_expect_success '--color overrides auto-color' '
329330
test_cmp expect.color actual
330331
'
331332

332-
test_expect_success PREPARE_FOR_MAIN_BRANCH 'verbose output lists worktree path' '
333+
test_expect_success 'verbose output lists worktree path' '
333334
one=$(git rev-parse --short HEAD) &&
334-
two=$(git rev-parse --short master) &&
335+
two=$(git rev-parse --short main) &&
335336
cat >expect <<-EOF &&
336337
* (HEAD detached from fromtag) $one one
337338
ambiguous $one one

0 commit comments

Comments
 (0)