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