t2*: adjust the references to the default branch name "main"

Carefully excluding t2106, which sees independent development elsewhere at the time of writing, we transition above-mentioned tests 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' -- t2*.sh && git checkout HEAD -- t2106\*) 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 883b98efade212bf1496a93dd8a691355a31daf0
19 files changed +219 -219
t/t2007-checkout-symlink.sh
+6 -6
@@ -4,7 +4,7 @@
4
5 test_description='git checkout to switch between branches with symlink<->dir'
6
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
@@ -15,14 +15,14 @@ test_expect_success setup '
15 echo hello >frotz/filfre &&
16 git add frotz/filfre &&
17 test_tick &&
18 - git commit -m "master has file frotz/filfre" &&
18 + git commit -m "main has file frotz/filfre" &&
19
20 git branch side &&
21
22 echo goodbye >nitfol &&
23 git add nitfol &&
24 test_tick &&
25 - git commit -m "master adds file nitfol" &&
25 + git commit -m "main adds file nitfol" &&
26
27 git checkout side &&
28
@@ -37,13 +37,13 @@ test_expect_success setup '
37
38 test_expect_success 'switch from symlink to dir' '
39
40 - git checkout master
40 + git checkout main
41
42 '
43
44 -test_expect_success 'Remove temporary directories & switch to master' '
44 +test_expect_success 'Remove temporary directories & switch to main' '
45 rm -fr frotz xyzzy nitfol &&
46 - git checkout -f master
46 + git checkout -f main
47 '
48
49 test_expect_success 'switch from dir to symlink' '
t/t2009-checkout-statinfo.sh
+5 -5
@@ -2,7 +2,7 @@
2
3 test_description='checkout should leave clean stat info'
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
@@ -24,13 +24,13 @@ test_expect_success 'branch switching' '
24 git reset --hard &&
25 test "$(git diff-files --raw)" = "" &&
26
27 - git checkout master &&
27 + git checkout main &&
28 test "$(git diff-files --raw)" = "" &&
29
30 git checkout side &&
31 test "$(git diff-files --raw)" = "" &&
32
33 - git checkout master &&
33 + git checkout main &&
34 test "$(git diff-files --raw)" = ""
35
36 '
@@ -40,13 +40,13 @@ test_expect_success 'path checkout' '
40 git reset --hard &&
41 test "$(git diff-files --raw)" = "" &&
42
43 - git checkout master world &&
43 + git checkout main world &&
44 test "$(git diff-files --raw)" = "" &&
45
46 git checkout side world &&
47 test "$(git diff-files --raw)" = "" &&
48
49 - git checkout master world &&
49 + git checkout main world &&
50 test "$(git diff-files --raw)" = ""
51
52 '
t/t2010-checkout-ambiguous.sh
+3 -3
@@ -2,7 +2,7 @@
2
3 test_description='checkout and pathspecs/refspecs ambiguities'
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
@@ -20,7 +20,7 @@ test_expect_success 'reference must be a tree' '
20 '
21
22 test_expect_success 'branch switching' '
23 - test "refs/heads/master" = "$(git symbolic-ref HEAD)" &&
23 + test "refs/heads/main" = "$(git symbolic-ref HEAD)" &&
24 git checkout world -- &&
25 test "refs/heads/world" = "$(git symbolic-ref HEAD)"
26 '
@@ -60,7 +60,7 @@ test_expect_success 'disambiguate checking out from a tree-ish' '
60 '
61
62 test_expect_success 'accurate error message with more than one ref' '
63 - test_must_fail git checkout HEAD master -- 2>actual &&
63 + test_must_fail git checkout HEAD main -- 2>actual &&
64 test_i18ngrep 2 actual &&
65 test_i18ngrep "one reference expected, 2 given" actual
66 '
t/t2011-checkout-invalid-head.sh
+9 -9
@@ -2,7 +2,7 @@
2
3 test_description='checkout switching away from an invalid branch'
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
@@ -14,12 +14,12 @@ test_expect_success 'setup' '
14 '
15
16 test_expect_success 'checkout should not start branch from a tree' '
17 - test_must_fail git checkout -b newbranch master^{tree}
17 + test_must_fail git checkout -b newbranch main^{tree}
18 '
19
20 -test_expect_success 'checkout master from invalid HEAD' '
20 +test_expect_success 'checkout main from invalid HEAD' '
21 echo $ZERO_OID >.git/HEAD &&
22 - git checkout master --
22 + git checkout main --
23 '
24
25 test_expect_success 'checkout notices failure to lock HEAD' '
@@ -29,7 +29,7 @@ test_expect_success 'checkout notices failure to lock HEAD' '
29 '
30
31 test_expect_success 'create ref directory/file conflict scenario' '
32 - git update-ref refs/heads/outer/inner master &&
32 + git update-ref refs/heads/outer/inner main &&
33
34 # do not rely on symbolic-ref to get a known state,
35 # as it may use the same code we are testing
@@ -40,12 +40,12 @@ test_expect_success 'create ref directory/file conflict scenario' '
40
41 test_expect_success 'checkout away from d/f HEAD (unpacked, to branch)' '
42 reset_to_df &&
43 - git checkout master
43 + git checkout main
44 '
45
46 test_expect_success 'checkout away from d/f HEAD (unpacked, to detached)' '
47 reset_to_df &&
48 - git checkout --detach master
48 + git checkout --detach main
49 '
50
51 test_expect_success 'pack refs' '
@@ -54,11 +54,11 @@ test_expect_success 'pack refs' '
54
55 test_expect_success 'checkout away from d/f HEAD (packed, to branch)' '
56 reset_to_df &&
57 - git checkout master
57 + git checkout main
58 '
59
60 test_expect_success 'checkout away from d/f HEAD (packed, to detached)' '
61 reset_to_df &&
62 - git checkout --detach master
62 + git checkout --detach main
63 '
64 test_done
t/t2012-checkout-last.sh
+25 -25
@@ -2,7 +2,7 @@
2
3 test_description='checkout can switch to last branch and merge base'
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
@@ -27,7 +27,7 @@ test_expect_success 'first branch switch' '
27
28 test_expect_success '"checkout -" switches back' '
29 git checkout - &&
30 - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"
30 + test "z$(git symbolic-ref HEAD)" = "zrefs/heads/main"
31 '
32
33 test_expect_success '"checkout -" switches forth' '
@@ -101,56 +101,56 @@ test_expect_success 'merge base test setup' '
101 git commit -m third
102 '
103
104 -test_expect_success 'another...master' '
104 +test_expect_success 'another...main' '
105 git checkout another &&
106 - git checkout another...master &&
107 - test "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify master^)"
106 + git checkout another...main &&
107 + test "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify main^)"
108 '
109
110 -test_expect_success '...master' '
110 +test_expect_success '...main' '
111 git checkout another &&
112 - git checkout ...master &&
113 - test "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify master^)"
112 + git checkout ...main &&
113 + test "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify main^)"
114 '
115
116 -test_expect_success 'master...' '
116 +test_expect_success 'main...' '
117 git checkout another &&
118 - git checkout master... &&
119 - test "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify master^)"
118 + git checkout main... &&
119 + test "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify main^)"
120 '
121
122 test_expect_success '"checkout -" works after a rebase A' '
123 - git checkout master &&
123 + git checkout main &&
124 git checkout other &&
125 - git rebase master &&
125 + git rebase main &&
126 git checkout - &&
127 - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"
127 + test "z$(git symbolic-ref HEAD)" = "zrefs/heads/main"
128 '
129
130 test_expect_success '"checkout -" works after a rebase A B' '
131 - git branch moodle master~1 &&
132 - git checkout master &&
131 + git branch moodle main~1 &&
132 + git checkout main &&
133 git checkout other &&
134 - git rebase master moodle &&
134 + git rebase main moodle &&
135 git checkout - &&
136 - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"
136 + test "z$(git symbolic-ref HEAD)" = "zrefs/heads/main"
137 '
138
139 test_expect_success '"checkout -" works after a rebase -i A' '
140 - git checkout master &&
140 + git checkout main &&
141 git checkout other &&
142 - git rebase -i master &&
142 + git rebase -i main &&
143 git checkout - &&
144 - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"
144 + test "z$(git symbolic-ref HEAD)" = "zrefs/heads/main"
145 '
146
147 test_expect_success '"checkout -" works after a rebase -i A B' '
148 - git branch foodle master~1 &&
149 - git checkout master &&
148 + git branch foodle main~1 &&
149 + git checkout main &&
150 git checkout other &&
151 - git rebase master foodle &&
151 + git rebase main foodle &&
152 git checkout - &&
153 - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"
153 + test "z$(git symbolic-ref HEAD)" = "zrefs/heads/main"
154 '
155
156 test_done
t/t2015-checkout-unborn.sh
+2 -2
@@ -1,7 +1,7 @@
1 #!/bin/sh
2
3 test_description='checkout from unborn branch'
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
@@ -14,7 +14,7 @@ test_expect_success 'setup' '
14 git add file &&
15 git commit -m base
16 ) &&
17 - git fetch parent master:origin
17 + git fetch parent main:origin
18 '
19
20 test_expect_success 'checkout from unborn preserves untracked files' '
t/t2017-checkout-orphan.sh
+23 -23
@@ -7,7 +7,7 @@ test_description='git checkout --orphan
7
8 Main Tests for --orphan functionality.'
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
@@ -32,34 +32,34 @@ test_expect_success '--orphan creates a new orphan branch from HEAD' '
32 test_tick &&
33 git commit -m "Third Commit" &&
34 test_must_fail git rev-parse --verify HEAD^ &&
35 - git diff-tree --quiet master alpha
35 + git diff-tree --quiet main alpha
36 '
37
38 test_expect_success '--orphan creates a new orphan branch from <start_point>' '
39 - git checkout master &&
40 - git checkout --orphan beta master^ &&
39 + git checkout main &&
40 + git checkout --orphan beta main^ &&
41 test_must_fail git rev-parse --verify HEAD &&
42 test "refs/heads/beta" = "$(git symbolic-ref HEAD)" &&
43 test_tick &&
44 git commit -m "Fourth Commit" &&
45 test_must_fail git rev-parse --verify HEAD^ &&
46 - git diff-tree --quiet master^ beta
46 + git diff-tree --quiet main^ beta
47 '
48
49 test_expect_success '--orphan must be rejected with -b' '
50 - git checkout master &&
50 + git checkout main &&
51 test_must_fail git checkout --orphan new -b newer &&
52 - test refs/heads/master = "$(git symbolic-ref HEAD)"
52 + test refs/heads/main = "$(git symbolic-ref HEAD)"
53 '
54
55 test_expect_success '--orphan must be rejected with -t' '
56 - git checkout master &&
57 - test_must_fail git checkout --orphan new -t master &&
58 - test refs/heads/master = "$(git symbolic-ref HEAD)"
56 + git checkout main &&
57 + test_must_fail git checkout --orphan new -t main &&
58 + test refs/heads/main = "$(git symbolic-ref HEAD)"
59 '
60
61 test_expect_success '--orphan ignores branch.autosetupmerge' '
62 - git checkout master &&
62 + git checkout main &&
63 git config branch.autosetupmerge always &&
64 git checkout --orphan gamma &&
65 test -z "$(git config branch.gamma.merge)" &&
@@ -68,7 +68,7 @@ test_expect_success '--orphan ignores branch.autosetupmerge' '
68 '
69
70 test_expect_success '--orphan makes reflog by default' '
71 - git checkout master &&
71 + git checkout main &&
72 git config --unset core.logAllRefUpdates &&
73 git checkout --orphan delta &&
74 test_must_fail git rev-parse --verify delta@{0} &&
@@ -77,7 +77,7 @@ test_expect_success '--orphan makes reflog by default' '
77 '
78
79 test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' '
80 - git checkout master &&
80 + git checkout main &&
81 git config core.logAllRefUpdates false &&
82 git checkout --orphan epsilon &&
83 test_must_fail git rev-parse --verify epsilon@{0} &&
@@ -86,7 +86,7 @@ test_expect_success '--orphan does not make reflog when core.logAllRefUpdates =
86 '
87
88 test_expect_success '--orphan with -l makes reflog when core.logAllRefUpdates = false' '
89 - git checkout master &&
89 + git checkout main &&
90 git checkout -l --orphan zeta &&
91 test_must_fail git rev-parse --verify zeta@{0} &&
92 git commit -m Zeta &&
@@ -94,33 +94,33 @@ test_expect_success '--orphan with -l makes reflog when core.logAllRefUpdates =
94 '
95
96 test_expect_success 'giving up --orphan not committed when -l and core.logAllRefUpdates = false deletes reflog' '
97 - git checkout master &&
97 + git checkout main &&
98 git checkout -l --orphan eta &&
99 test_must_fail git rev-parse --verify eta@{0} &&
100 - git checkout master &&
100 + git checkout main &&
101 test_must_fail git rev-parse --verify eta@{0}
102 '
103
104 test_expect_success '--orphan is rejected with an existing name' '
105 - git checkout master &&
106 - test_must_fail git checkout --orphan master &&
107 - test refs/heads/master = "$(git symbolic-ref HEAD)"
105 + git checkout main &&
106 + test_must_fail git checkout --orphan main &&
107 + test refs/heads/main = "$(git symbolic-ref HEAD)"
108 '
109
110 test_expect_success '--orphan refuses to switch if a merge is needed' '
111 - git checkout master &&
111 + git checkout main &&
112 git reset --hard &&
113 echo local >>"$TEST_FILE" &&
114 cat "$TEST_FILE" >"$TEST_FILE.saved" &&
115 - test_must_fail git checkout --orphan new master^ &&
116 - test refs/heads/master = "$(git symbolic-ref HEAD)" &&
115 + test_must_fail git checkout --orphan new main^ &&
116 + test refs/heads/main = "$(git symbolic-ref HEAD)" &&
117 test_cmp "$TEST_FILE" "$TEST_FILE.saved" &&
118 git diff-index --quiet --cached HEAD &&
119 git reset --hard
120 '
121
122 test_expect_success 'cannot --detach on an unborn branch' '
123 - git checkout master &&
123 + git checkout main &&
124 git checkout --orphan new &&
125 test_must_fail git checkout --detach
126 '
t/t2020-checkout-detach.sh
+15 -15
@@ -1,7 +1,7 @@
1 #!/bin/sh
2
3 test_description='checkout into detached HEAD state'
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
@@ -25,7 +25,7 @@ check_no_orphan_warning() {
25 }
26
27 reset () {
28 - git checkout master &&
28 + git checkout main &&
29 check_not_detached
30 }
31
@@ -88,7 +88,7 @@ test_expect_success 'checkout --detach errors out for non-commit' '
88
89 test_expect_success 'checkout --detach errors out for extra argument' '
90 reset &&
91 - git checkout master &&
91 + git checkout main &&
92 test_must_fail git checkout --detach tag one.t &&
93 check_not_detached
94 '
@@ -116,7 +116,7 @@ test_expect_success 'checkout warns on orphan commits' '
116 echo new content >orphan &&
117 git commit -a -m orphan2 &&
118 orphan2=$(git rev-parse HEAD) &&
119 - git checkout master 2>stderr
119 + git checkout main 2>stderr
120 '
121
122 test_expect_success 'checkout warns on orphan commits: output' '
@@ -135,7 +135,7 @@ test_expect_success 'checkout warns orphaning 1 of 2 commits: output' '
135 test_expect_success 'checkout does not warn leaving ref tip' '
136 reset &&
137 git checkout --detach two &&
138 - git checkout master 2>stderr
138 + git checkout main 2>stderr
139 '
140
141 test_expect_success 'checkout does not warn leaving ref tip' '
@@ -145,7 +145,7 @@ test_expect_success 'checkout does not warn leaving ref tip' '
145 test_expect_success 'checkout does not warn leaving reachable commit' '
146 reset &&
147 git checkout --detach HEAD^ &&
148 - git checkout master 2>stderr
148 + git checkout main 2>stderr
149 '
150
151 test_expect_success 'checkout does not warn leaving reachable commit' '
@@ -153,14 +153,14 @@ test_expect_success 'checkout does not warn leaving reachable commit' '
153 '
154
155 cat >expect <<'EOF'
156 -Your branch is behind 'master' by 1 commit, and can be fast-forwarded.
156 +Your branch is behind 'main' by 1 commit, and can be fast-forwarded.
157 (use "git pull" to update your local branch)
158 EOF
159 test_expect_success 'tracking count is accurate after orphan check' '
160 reset &&
161 - git branch child master^ &&
161 + git branch child main^ &&
162 git config branch.child.remote . &&
163 - git config branch.child.merge refs/heads/master &&
163 + git config branch.child.merge refs/heads/main &&
164 git checkout child^ &&
165 git checkout child >stdout &&
166 test_i18ncmp expect stdout
@@ -192,9 +192,9 @@ test_expect_success 'no advice given for explicit detached head state' '
192 # Detached HEAD tests for GIT_PRINT_SHA1_ELLIPSIS (new format)
193 test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not asked to' "
194
195 - commit=$(git rev-parse --short=12 master^) &&
196 - commit2=$(git rev-parse --short=12 master~2) &&
197 - commit3=$(git rev-parse --short=12 master~3) &&
195 + commit=$(git rev-parse --short=12 main^) &&
196 + commit2=$(git rev-parse --short=12 main~2) &&
197 + commit3=$(git rev-parse --short=12 main~3) &&
198
199 # The first detach operation is more chatty than the following ones.
200 cat >1st_detach <<-EOF &&
@@ -274,9 +274,9 @@ test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not as
274 # Detached HEAD tests for GIT_PRINT_SHA1_ELLIPSIS (old format)
275 test_expect_success 'describe_detached_head does print SHA-1 ellipsis when asked to' "
276
277 - commit=$(git rev-parse --short=12 master^) &&
278 - commit2=$(git rev-parse --short=12 master~2) &&
279 - commit3=$(git rev-parse --short=12 master~3) &&
277 + commit=$(git rev-parse --short=12 main^) &&
278 + commit2=$(git rev-parse --short=12 main~2) &&
279 + commit3=$(git rev-parse --short=12 main~3) &&
280
281 # The first detach operation is more chatty than the following ones.
282 cat >1st_detach <<-EOF &&
t/t2022-checkout-paths.sh
+12 -12
@@ -1,22 +1,22 @@
1 #!/bin/sh
2
3 test_description='checkout $tree -- $paths'
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
8
9 test_expect_success setup '
10 mkdir dir &&
11 - >dir/master &&
11 + >dir/main &&
12 echo common >dir/common &&
13 - git add dir/master dir/common &&
14 - test_tick && git commit -m "master has dir/master" &&
13 + git add dir/main dir/common &&
14 + test_tick && git commit -m "main has dir/main" &&
15 git checkout -b next &&
16 - git mv dir/master dir/next0 &&
16 + git mv dir/main dir/next0 &&
17 echo next >dir/next1 &&
18 git add dir &&
19 - test_tick && git commit -m "next has dir/next but not dir/master"
19 + test_tick && git commit -m "next has dir/next but not dir/main"
20 '
21
22 test_expect_success 'checking out paths out of a tree does not clobber unrelated paths' '
@@ -29,11 +29,11 @@ test_expect_success 'checking out paths out of a tree does not clobber unrelated
29 echo untracked >expect.next2 &&
30 cat expect.next2 >dir/next2 &&
31
32 - git checkout master dir &&
32 + git checkout main dir &&
33
34 test_cmp expect.common dir/common &&
35 - test_path_is_file dir/master &&
36 - git diff --exit-code master dir/master &&
35 + test_path_is_file dir/main &&
36 + git diff --exit-code main dir/main &&
37
38 test_path_is_missing dir/next0 &&
39 test_cmp expect.next1 dir/next1 &&
@@ -55,11 +55,11 @@ test_expect_success 'do not touch unmerged entries matching $path but not in $tr
55 EOF
56 git update-index --index-info <expect.next0 &&
57
58 - git checkout master dir &&
58 + git checkout main dir &&
59
60 test_cmp expect.common dir/common &&
61 - test_path_is_file dir/master &&
62 - git diff --exit-code master dir/master &&
61 + test_path_is_file dir/main &&
62 + git diff --exit-code main dir/main &&
63 git ls-files -s dir/next0 >actual.next0 &&
64 test_cmp expect.next0 actual.next0
65 '
t/t2023-checkout-m.sh
+6 -6
@@ -4,7 +4,7 @@ test_description='checkout -m -- <conflicted path>
4
5 Ensures that checkout -m on a resolved file restores the conflicted file'
6
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
@@ -13,15 +13,15 @@ test_expect_success setup '
13 test_tick &&
14 test_commit both.txt both.txt initial &&
15 git branch topic &&
16 - test_commit modified_in_master both.txt in_master &&
17 - test_commit added_in_master each.txt in_master &&
16 + test_commit modified_in_main both.txt in_main &&
17 + test_commit added_in_main each.txt in_main &&
18 git checkout topic &&
19 test_commit modified_in_topic both.txt in_topic &&
20 test_commit added_in_topic each.txt in_topic
21 '
22
23 -test_expect_success 'git merge master' '
24 - test_must_fail git merge master
23 +test_expect_success 'git merge main' '
24 + test_must_fail git merge main
25 '
26
27 clean_branchnames () {
@@ -64,7 +64,7 @@ test_expect_success 'force checkout a conflict file creates stage zero entry' '
64 git checkout topic &&
65 echo c >a &&
66 C_OBJ=$(git hash-object a) &&
67 - git checkout -m master &&
67 + git checkout -m main &&
68 test_cmp_rev :1:a $A_OBJ &&
69 test_cmp_rev :2:a $B_OBJ &&
70 test_cmp_rev :3:a $C_OBJ &&
t/t2024-checkout-dwim.sh
+35 -35
@@ -29,11 +29,11 @@ status_uno_is_clean () {
29 }
30
31 test_expect_success 'setup' '
32 - test_commit my_master &&
32 + test_commit my_main &&
33 git init repo_a &&
34 (
35 cd repo_a &&
36 - test_commit a_master &&
36 + test_commit a_main &&
37 git checkout -b foo &&
38 test_commit a_foo &&
39 git checkout -b bar &&
@@ -44,7 +44,7 @@ test_expect_success 'setup' '
44 git init repo_b &&
45 (
46 cd repo_b &&
47 - test_commit b_master &&
47 + test_commit b_main &&
48 git checkout -b foo &&
49 test_commit b_foo &&
50 git checkout -b baz &&
@@ -60,23 +60,23 @@ test_expect_success 'setup' '
60 '
61
62 test_expect_success 'checkout of non-existing branch fails' '
63 - git checkout -B master &&
63 + git checkout -B main &&
64 test_might_fail git branch -D xyzzy &&
65
66 test_must_fail git checkout xyzzy &&
67 status_uno_is_clean &&
68 test_must_fail git rev-parse --verify refs/heads/xyzzy &&
69 - test_branch master
69 + test_branch main
70 '
71
72 test_expect_success 'checkout of branch from multiple remotes fails #1' '
73 - git checkout -B master &&
73 + git checkout -B main &&
74 test_might_fail git branch -D foo &&
75
76 test_must_fail git checkout foo &&
77 status_uno_is_clean &&
78 test_must_fail git rev-parse --verify refs/heads/foo &&
79 - test_branch master
79 + test_branch main
80 '
81
82 test_expect_success 'when arg matches multiple remotes, do not fallback to interpreting as pathspec' '
@@ -100,21 +100,21 @@ test_expect_success 'when arg matches multiple remotes, do not fallback to inter
100 '
101
102 test_expect_success 'checkout of branch from multiple remotes fails with advice' '
103 - git checkout -B master &&
103 + git checkout -B main &&
104 test_might_fail git branch -D foo &&
105 test_must_fail git checkout foo 2>stderr &&
106 - test_branch master &&
106 + test_branch main &&
107 status_uno_is_clean &&
108 test_i18ngrep "^hint: " stderr &&
109 test_must_fail git -c advice.checkoutAmbiguousRemoteBranchName=false \
110 checkout foo 2>stderr &&
111 - test_branch master &&
111 + test_branch main &&
112 status_uno_is_clean &&
113 test_i18ngrep ! "^hint: " stderr
114 '
115
116 test_expect_success PERL 'checkout -p with multiple remotes does not print advice' '
117 - git checkout -B master &&
117 + git checkout -B main &&
118 test_might_fail git branch -D foo &&
119
120 git checkout -p foo 2>stderr &&
@@ -123,7 +123,7 @@ test_expect_success PERL 'checkout -p with multiple remotes does not print advic
123 '
124
125 test_expect_success 'checkout of branch from multiple remotes succeeds with checkout.defaultRemote #1' '
126 - git checkout -B master &&
126 + git checkout -B main &&
127 status_uno_is_clean &&
128 test_might_fail git branch -D foo &&
129
@@ -135,7 +135,7 @@ test_expect_success 'checkout of branch from multiple remotes succeeds with chec
135 '
136
137 test_expect_success 'checkout of branch from a single remote succeeds #1' '
138 - git checkout -B master &&
138 + git checkout -B main &&
139 test_might_fail git branch -D bar &&
140
141 git checkout bar &&
@@ -146,7 +146,7 @@ test_expect_success 'checkout of branch from a single remote succeeds #1' '
146 '
147
148 test_expect_success 'checkout of branch from a single remote succeeds #2' '
149 - git checkout -B master &&
149 + git checkout -B main &&
150 test_might_fail git branch -D baz &&
151
152 git checkout baz &&
@@ -157,33 +157,33 @@ test_expect_success 'checkout of branch from a single remote succeeds #2' '
157 '
158
159 test_expect_success '--no-guess suppresses branch auto-vivification' '
160 - git checkout -B master &&
160 + git checkout -B main &&
161 status_uno_is_clean &&
162 test_might_fail git branch -D bar &&
163
164 test_must_fail git checkout --no-guess bar &&
165 test_must_fail git rev-parse --verify refs/heads/bar &&
166 - test_branch master
166 + test_branch main
167 '
168
169 test_expect_success 'checkout.guess = false suppresses branch auto-vivification' '
170 - git checkout -B master &&
170 + git checkout -B main &&
171 status_uno_is_clean &&
172 test_might_fail git branch -D bar &&
173
174 test_config checkout.guess false &&
175 test_must_fail git checkout bar &&
176 test_must_fail git rev-parse --verify refs/heads/bar &&
177 - test_branch master
177 + test_branch main
178 '
179
180 test_expect_success 'setup more remotes with unconventional refspecs' '
181 - git checkout -B master &&
181 + git checkout -B main &&
182 status_uno_is_clean &&
183 git init repo_c &&
184 (
185 cd repo_c &&
186 - test_commit c_master &&
186 + test_commit c_main &&
187 git checkout -b bar &&
188 test_commit c_bar &&
189 git checkout -b spam &&
@@ -192,7 +192,7 @@ test_expect_success 'setup more remotes with unconventional refspecs' '
192 git init repo_d &&
193 (
194 cd repo_d &&
195 - test_commit d_master &&
195 + test_commit d_main &&
196 git checkout -b baz &&
197 test_commit d_baz &&
198 git checkout -b eggs &&
@@ -208,29 +208,29 @@ test_expect_success 'setup more remotes with unconventional refspecs' '
208 '
209
210 test_expect_success 'checkout of branch from multiple remotes fails #2' '
211 - git checkout -B master &&
211 + git checkout -B main &&
212 status_uno_is_clean &&
213 test_might_fail git branch -D bar &&
214
215 test_must_fail git checkout bar &&
216 status_uno_is_clean &&
217 test_must_fail git rev-parse --verify refs/heads/bar &&
218 - test_branch master
218 + test_branch main
219 '
220
221 test_expect_success 'checkout of branch from multiple remotes fails #3' '
222 - git checkout -B master &&
222 + git checkout -B main &&
223 status_uno_is_clean &&
224 test_might_fail git branch -D baz &&
225
226 test_must_fail git checkout baz &&
227 status_uno_is_clean &&
228 test_must_fail git rev-parse --verify refs/heads/baz &&
229 - test_branch master
229 + test_branch main
230 '
231
232 test_expect_success 'checkout of branch from a single remote succeeds #3' '
233 - git checkout -B master &&
233 + git checkout -B main &&
234 status_uno_is_clean &&
235 test_might_fail git branch -D spam &&
236
@@ -242,7 +242,7 @@ test_expect_success 'checkout of branch from a single remote succeeds #3' '
242 '
243
244 test_expect_success 'checkout of branch from a single remote succeeds #4' '
245 - git checkout -B master &&
245 + git checkout -B main &&
246 status_uno_is_clean &&
247 test_might_fail git branch -D eggs &&
248
@@ -254,7 +254,7 @@ test_expect_success 'checkout of branch from a single remote succeeds #4' '
254 '
255
256 test_expect_success 'checkout of branch with a file having the same name fails' '
257 - git checkout -B master &&
257 + git checkout -B main &&
258 status_uno_is_clean &&
259 test_might_fail git branch -D spam &&
260
@@ -262,11 +262,11 @@ test_expect_success 'checkout of branch with a file having the same name fails'
262 test_must_fail git checkout spam &&
263 status_uno_is_clean &&
264 test_must_fail git rev-parse --verify refs/heads/spam &&
265 - test_branch master
265 + test_branch main
266 '
267
268 test_expect_success 'checkout of branch with a file in subdir having the same name fails' '
269 - git checkout -B master &&
269 + git checkout -B main &&
270 status_uno_is_clean &&
271 test_might_fail git branch -D spam &&
272
@@ -276,11 +276,11 @@ test_expect_success 'checkout of branch with a file in subdir having the same na
276 test_must_fail git -C sub checkout spam &&
277 status_uno_is_clean &&
278 test_must_fail git rev-parse --verify refs/heads/spam &&
279 - test_branch master
279 + test_branch main
280 '
281
282 test_expect_success 'checkout <branch> -- succeeds, even if a file with the same name exists' '
283 - git checkout -B master &&
283 + git checkout -B main &&
284 status_uno_is_clean &&
285 test_might_fail git branch -D spam &&
286
@@ -294,7 +294,7 @@ test_expect_success 'checkout <branch> -- succeeds, even if a file with the same
294
295 test_expect_success 'loosely defined local base branch is reported correctly' '
296
297 - git checkout master &&
297 + git checkout main &&
298 status_uno_is_clean &&
299 git branch strict &&
300 git branch loose &&
@@ -302,8 +302,8 @@ test_expect_success 'loosely defined local base branch is reported correctly' '
302
303 test_config branch.strict.remote . &&
304 test_config branch.loose.remote . &&
305 - test_config branch.strict.merge refs/heads/master &&
306 - test_config branch.loose.merge master &&
305 + test_config branch.strict.merge refs/heads/main &&
306 + test_config branch.loose.merge main &&
307
308 git checkout strict | sed -e "s/strict/BRANCHNAME/g" >expect &&
309 status_uno_is_clean &&
t/t2027-checkout-track.sh
+4 -4
@@ -2,7 +2,7 @@
2
3 test_description='tests for git branch --track'
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
@@ -13,14 +13,14 @@ test_expect_success 'setup' '
13 '
14
15 test_expect_success 'checkout --track -b creates a new tracking branch' '
16 - git checkout --track -b branch1 master &&
16 + git checkout --track -b branch1 main &&
17 test $(git rev-parse --abbrev-ref HEAD) = branch1 &&
18 test $(git config --get branch.branch1.remote) = . &&
19 - test $(git config --get branch.branch1.merge) = refs/heads/master
19 + test $(git config --get branch.branch1.merge) = refs/heads/main
20 '
21
22 test_expect_success 'checkout --track -b rejects an extra path argument' '
23 - test_must_fail git checkout --track -b branch2 master one.t 2>err &&
23 + test_must_fail git checkout --track -b branch2 main one.t 2>err &&
24 test_i18ngrep "cannot be used with updating paths" err
25 '
26
t/t2030-unresolve-info.sh
+4 -4
@@ -2,7 +2,7 @@
2
3 test_description='undoing resolution'
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
@@ -62,7 +62,7 @@ test_expect_success setup '
62 test_commit fourth fi/le fourth &&
63 git checkout add-add &&
64 test_commit fifth add-differently &&
65 - git checkout master
65 + git checkout main
66 '
67
68 test_expect_success 'add records switch clears' '
@@ -186,8 +186,8 @@ test_expect_success 'rerere forget (binary)' '
186 '
187
188 test_expect_success 'rerere forget (add-add conflict)' '
189 - git checkout -f master &&
190 - echo master >add-differently &&
189 + git checkout -f main &&
190 + echo main >add-differently &&
191 git add add-differently &&
192 git commit -m "add differently" &&
193 test_must_fail git merge fifth &&
t/t2060-switch.sh
+16 -16
@@ -2,7 +2,7 @@
2
3 test_description='switch basic functionality'
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
@@ -26,41 +26,41 @@ test_expect_success 'switch branch' '
26 '
27
28 test_expect_success 'switch and detach' '
29 - test_when_finished git switch master &&
30 - test_must_fail git switch master^{commit} &&
31 - git switch --detach master^{commit} &&
29 + test_when_finished git switch main &&
30 + test_must_fail git switch main^{commit} &&
31 + git switch --detach main^{commit} &&
32 test_must_fail git symbolic-ref HEAD
33 '
34
35 test_expect_success 'switch and detach current branch' '
36 - test_when_finished git switch master &&
37 - git switch master &&
36 + test_when_finished git switch main &&
37 + git switch main &&
38 git switch --detach &&
39 test_must_fail git symbolic-ref HEAD
40 '
41
42 test_expect_success 'switch and create branch' '
43 - test_when_finished git switch master &&
44 - git switch -c temp master^ &&
45 - test_cmp_rev master^ refs/heads/temp &&
43 + test_when_finished git switch main &&
44 + git switch -c temp main^ &&
45 + test_cmp_rev main^ refs/heads/temp &&
46 echo refs/heads/temp >expected-branch &&
47 git symbolic-ref HEAD >actual-branch &&
48 test_cmp expected-branch actual-branch
49 '
50
51 test_expect_success 'force create branch from HEAD' '
52 - test_when_finished git switch master &&
53 - git switch --detach master &&
52 + test_when_finished git switch main &&
53 + git switch --detach main &&
54 test_must_fail git switch -c temp &&
55 git switch -C temp &&
56 - test_cmp_rev master refs/heads/temp &&
56 + test_cmp_rev main refs/heads/temp &&
57 echo refs/heads/temp >expected-branch &&
58 git symbolic-ref HEAD >actual-branch &&
59 test_cmp expected-branch actual-branch
60 '
61
62 test_expect_success 'new orphan branch from empty' '
63 - test_when_finished git switch master &&
63 + test_when_finished git switch main &&
64 test_must_fail git switch --orphan new-orphan HEAD &&
65 git switch --orphan new-orphan &&
66 test_commit orphan &&
@@ -72,7 +72,7 @@ test_expect_success 'new orphan branch from empty' '
72 '
73
74 test_expect_success 'orphan branch works with --discard-changes' '
75 - test_when_finished git switch master &&
75 + test_when_finished git switch main &&
76 echo foo >foo.txt &&
77 git switch --discard-changes --orphan new-orphan2 &&
78 git ls-files >tracked-files &&
@@ -80,7 +80,7 @@ test_expect_success 'orphan branch works with --discard-changes' '
80 '
81
82 test_expect_success 'switching ignores file of same branch name' '
83 - test_when_finished git switch master &&
83 + test_when_finished git switch main &&
84 : >first-branch &&
85 git switch first-branch &&
86 echo refs/heads/first-branch >expected &&
@@ -89,7 +89,7 @@ test_expect_success 'switching ignores file of same branch name' '
89 '
90
91 test_expect_success 'guess and create branch' '
92 - test_when_finished git switch master &&
92 + test_when_finished git switch main &&
93 test_must_fail git switch --no-guess foo &&
94 test_config checkout.guess false &&
95 test_must_fail git switch foo &&
t/t2070-restore.sh
+3 -3
@@ -2,7 +2,7 @@
2
3 test_description='restore basic functionality'
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
@@ -18,7 +18,7 @@ test_expect_success 'setup' '
18 echo ignored >ignored &&
19 echo /ignored >.gitignore &&
20 git add one two .gitignore &&
21 - git update-ref refs/heads/one master
21 + git update-ref refs/heads/one main
22 '
23
24 test_expect_success 'restore without pathspec is not ok' '
@@ -94,7 +94,7 @@ test_expect_success 'restore --ignore-unmerged ignores unmerged entries' '
94 git switch -c first &&
95 echo first >unmerged &&
96 git commit -am first &&
97 - git switch -c second master &&
97 + git switch -c second main &&
98 echo second >unmerged &&
99 git commit -am second &&
100 test_must_fail git merge first &&
t/t2400-worktree-add.sh
+34 -34
@@ -2,7 +2,7 @@
2
3 test_description='test git worktree add'
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
@@ -15,12 +15,12 @@ test_expect_success 'setup' '
15
16 test_expect_success '"add" an existing worktree' '
17 mkdir -p existing/subtree &&
18 - test_must_fail git worktree add --detach existing master
18 + test_must_fail git worktree add --detach existing main
19 '
20
21 test_expect_success '"add" an existing empty worktree' '
22 mkdir existing_empty &&
23 - git worktree add --detach existing_empty master
23 + git worktree add --detach existing_empty main
24 '
25
26 test_expect_success '"add" using shorthand - fails when no previous branch' '
@@ -32,7 +32,7 @@ test_expect_success '"add" using - shorthand' '
32 echo hello >myworld &&
33 git add myworld &&
34 git commit -m myworld &&
35 - git checkout master &&
35 + git checkout main &&
36 git worktree add short-hand - &&
37 echo refs/heads/newbranch >expect &&
38 git -C short-hand rev-parse --symbolic-full-name HEAD >actual &&
@@ -40,7 +40,7 @@ test_expect_success '"add" using - shorthand' '
40 '
41
42 test_expect_success '"add" refuses to checkout locked branch' '
43 - test_must_fail git worktree add zere master &&
43 + test_must_fail git worktree add zere main &&
44 ! test -d zere &&
45 ! test -d .git/worktrees/zere
46 '
@@ -49,13 +49,13 @@ test_expect_success 'checking out paths not complaining about linked checkouts'
49 (
50 cd existing_empty &&
51 echo dirty >>init.t &&
52 - git checkout master -- init.t
52 + git checkout main -- init.t
53 )
54 '
55
56 test_expect_success '"add" worktree' '
57 git rev-parse HEAD >expect &&
58 - git worktree add --detach here master &&
58 + git worktree add --detach here main &&
59 (
60 cd here &&
61 test_cmp ../init.t init.t &&
@@ -68,7 +68,7 @@ test_expect_success '"add" worktree' '
68
69 test_expect_success '"add" worktree with lock' '
70 git rev-parse HEAD >expect &&
71 - git worktree add --detach --lock here-with-lock master &&
71 + git worktree add --detach --lock here-with-lock main &&
72 test -f .git/worktrees/here-with-lock/locked
73 '
74
@@ -76,7 +76,7 @@ test_expect_success '"add" worktree from a subdir' '
76 (
77 mkdir sub &&
78 cd sub &&
79 - git worktree add --detach here master &&
79 + git worktree add --detach here main &&
80 cd here &&
81 test_cmp ../../init.t init.t
82 )
@@ -85,19 +85,19 @@ test_expect_success '"add" worktree from a subdir' '
85 test_expect_success '"add" from a linked checkout' '
86 (
87 cd here &&
88 - git worktree add --detach nested-here master &&
88 + git worktree add --detach nested-here main &&
89 cd nested-here &&
90 git fsck
91 )
92 '
93
94 test_expect_success '"add" worktree creating new branch' '
95 - git worktree add -b newmaster there master &&
95 + git worktree add -b newmain there main &&
96 (
97 cd there &&
98 test_cmp ../init.t init.t &&
99 git symbolic-ref HEAD >actual &&
100 - echo refs/heads/newmaster >expect &&
100 + echo refs/heads/newmain >expect &&
101 test_cmp expect actual &&
102 git fsck
103 )
@@ -106,7 +106,7 @@ test_expect_success '"add" worktree creating new branch' '
106 test_expect_success 'die the same branch is already checked out' '
107 (
108 cd here &&
109 - test_must_fail git checkout newmaster
109 + test_must_fail git checkout newmain
110 )
111 '
112
@@ -115,20 +115,20 @@ test_expect_success SYMLINKS 'die the same branch is already checked out (symlin
115 ref=$(git -C there symbolic-ref HEAD) &&
116 rm "$head" &&
117 ln -s "$ref" "$head" &&
118 - test_must_fail git -C here checkout newmaster
118 + test_must_fail git -C here checkout newmain
119 '
120
121 test_expect_success 'not die the same branch is already checked out' '
122 (
123 cd here &&
124 - git worktree add --force anothernewmaster newmaster
124 + git worktree add --force anothernewmain newmain
125 )
126 '
127
128 test_expect_success 'not die on re-checking out current branch' '
129 (
130 cd there &&
131 - git checkout newmaster
131 + git checkout newmain
132 )
133 '
134
@@ -136,14 +136,14 @@ test_expect_success '"add" from a bare repo' '
136 (
137 git clone --bare . bare &&
138 cd bare &&
139 - git worktree add -b bare-master ../there2 master
139 + git worktree add -b bare-main ../there2 main
140 )
141 '
142
143 test_expect_success 'checkout from a bare repo without "add"' '
144 (
145 cd bare &&
146 - test_must_fail git checkout master
146 + test_must_fail git checkout main
147 )
148 '
149
@@ -151,7 +151,7 @@ test_expect_success '"add" default branch of a bare repo' '
151 (
152 git clone --bare . bare2 &&
153 cd bare2 &&
154 - git worktree add ../there3 master
154 + git worktree add ../there3 main
155 )
156 '
157
@@ -168,7 +168,7 @@ test_expect_success 'checkout with grafts' '
168 EOF
169 git log --format=%s -2 >actual &&
170 test_cmp expected actual &&
171 - git worktree add --detach grafted master &&
171 + git worktree add --detach grafted main &&
172 git --git-dir=grafted/.git log --format=%s -2 >actual &&
173 test_cmp expected actual
174 '
@@ -229,34 +229,34 @@ test_expect_success '"add" no auto-vivify with --detach and <branch> omitted' '
229 '
230
231 test_expect_success '"add" -b/-B mutually exclusive' '
232 - test_must_fail git worktree add -b poodle -B poodle bamboo master
232 + test_must_fail git worktree add -b poodle -B poodle bamboo main
233 '
234
235 test_expect_success '"add" -b/--detach mutually exclusive' '
236 - test_must_fail git worktree add -b poodle --detach bamboo master
236 + test_must_fail git worktree add -b poodle --detach bamboo main
237 '
238
239 test_expect_success '"add" -B/--detach mutually exclusive' '
240 - test_must_fail git worktree add -B poodle --detach bamboo master
240 + test_must_fail git worktree add -B poodle --detach bamboo main
241 '
242
243 test_expect_success '"add -B" fails if the branch is checked out' '
244 - git rev-parse newmaster >before &&
245 - test_must_fail git worktree add -B newmaster bamboo master &&
246 - git rev-parse newmaster >after &&
244 + git rev-parse newmain >before &&
245 + test_must_fail git worktree add -B newmain bamboo main &&
246 + git rev-parse newmain >after &&
247 test_cmp before after
248 '
249
250 test_expect_success 'add -B' '
251 - git worktree add -B poodle bamboo2 master^ &&
251 + git worktree add -B poodle bamboo2 main^ &&
252 git -C bamboo2 symbolic-ref HEAD >actual &&
253 echo refs/heads/poodle >expected &&
254 test_cmp expected actual &&
255 - test_cmp_rev master^ poodle
255 + test_cmp_rev main^ poodle
256 '
257
258 test_expect_success 'add --quiet' '
259 - git worktree add --quiet another-worktree master 2>actual &&
259 + git worktree add --quiet another-worktree main 2>actual &&
260 test_must_be_empty actual
261 '
262
@@ -351,24 +351,24 @@ test_branch_upstream () {
351
352 test_expect_success '--track sets up tracking' '
353 test_when_finished rm -rf track &&
354 - git worktree add --track -b track track master &&
355 - test_branch_upstream track . master
354 + git worktree add --track -b track track main &&
355 + test_branch_upstream track . main
356 '
357
358 # setup remote repository $1 and repository $2 with $1 set up as
359 -# remote. The remote has two branches, master and foo.
359 +# remote. The remote has two branches, main and foo.
360 setup_remote_repo () {
361 git init $1 &&
362 (
363 cd $1 &&
364 - test_commit $1_master &&
364 + test_commit $1_main &&
365 git checkout -b foo &&
366 test_commit upstream_foo
367 ) &&
368 git init $2 &&
369 (
370 cd $2 &&
371 - test_commit $2_master &&
371 + test_commit $2_main &&
372 git remote add $1 ../$1 &&
373 git config remote.$1.fetch \
374 "refs/heads/*:refs/remotes/$1/*" &&
t/t2401-worktree-prune.sh
+2 -2
@@ -2,7 +2,7 @@
2
3 test_description='prune $GIT_DIR/worktrees'
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
@@ -90,7 +90,7 @@ test_expect_success 'not prune recent checkouts' '
90
91 test_expect_success 'not prune proper checkouts' '
92 test_when_finished rm -r .git/worktrees &&
93 - git worktree add --detach "$PWD/nop" master &&
93 + git worktree add --detach "$PWD/nop" main &&
94 git worktree prune &&
95 test -d .git/worktrees/nop
96 '
t/t2402-worktree-list.sh
+11 -11
@@ -2,7 +2,7 @@
2
3 test_description='test git worktree list'
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
@@ -24,7 +24,7 @@ test_expect_success 'rev-parse --git-common-dir on main worktree' '
24 test_expect_success 'rev-parse --git-path objects linked worktree' '
25 echo "$(git rev-parse --show-toplevel)/.git/objects" >expect &&
26 test_when_finished "rm -rf linked-tree actual expect && git worktree prune" &&
27 - git worktree add --detach linked-tree master &&
27 + git worktree add --detach linked-tree main &&
28 git -C linked-tree rev-parse --git-path objects >actual &&
29 test_cmp expect actual
30 '
@@ -32,7 +32,7 @@ test_expect_success 'rev-parse --git-path objects linked worktree' '
32 test_expect_success '"list" all worktrees from main' '
33 echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
34 test_when_finished "rm -rf here out actual expect && git worktree prune" &&
35 - git worktree add --detach here master &&
35 + git worktree add --detach here main &&
36 echo "$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect &&
37 git worktree list >out &&
38 sed "s/ */ /g" <out >actual &&
@@ -42,7 +42,7 @@ test_expect_success '"list" all worktrees from main' '
42 test_expect_success '"list" all worktrees from linked' '
43 echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
44 test_when_finished "rm -rf here out actual expect && git worktree prune" &&
45 - git worktree add --detach here master &&
45 + git worktree add --detach here main &&
46 echo "$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect &&
47 git -C here worktree list >out &&
48 sed "s/ */ /g" <out >actual &&
@@ -55,7 +55,7 @@ test_expect_success '"list" all worktrees --porcelain' '
55 echo "branch $(git symbolic-ref HEAD)" >>expect &&
56 echo >>expect &&
57 test_when_finished "rm -rf here actual expect && git worktree prune" &&
58 - git worktree add --detach here master &&
58 + git worktree add --detach here main &&
59 echo "worktree $(git -C here rev-parse --show-toplevel)" >>expect &&
60 echo "HEAD $(git rev-parse HEAD)" >>expect &&
61 echo "detached" >>expect &&
@@ -66,8 +66,8 @@ test_expect_success '"list" all worktrees --porcelain' '
66
67 test_expect_success '"list" all worktrees with locked annotation' '
68 test_when_finished "rm -rf locked unlocked out && git worktree prune" &&
69 - git worktree add --detach locked master &&
70 - git worktree add --detach unlocked master &&
69 + git worktree add --detach locked main &&
70 + git worktree add --detach unlocked main &&
71 git worktree lock locked &&
72 git worktree list >out &&
73 grep "/locked *[0-9a-f].* locked$" out &&
@@ -79,13 +79,13 @@ test_expect_success 'bare repo setup' '
79 echo "data" >file1 &&
80 git add file1 &&
81 git commit -m"File1: add data" &&
82 - git push bare1 master &&
82 + git push bare1 main &&
83 git reset --hard HEAD^
84 '
85
86 test_expect_success '"list" all worktrees from bare main' '
87 test_when_finished "rm -rf there out actual expect && git -C bare1 worktree prune" &&
88 - git -C bare1 worktree add --detach ../there master &&
88 + git -C bare1 worktree add --detach ../there main &&
89 echo "$(pwd)/bare1 (bare)" >expect &&
90 echo "$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)" >>expect &&
91 git -C bare1 worktree list >out &&
@@ -95,7 +95,7 @@ test_expect_success '"list" all worktrees from bare main' '
95
96 test_expect_success '"list" all worktrees --porcelain from bare main' '
97 test_when_finished "rm -rf there actual expect && git -C bare1 worktree prune" &&
98 - git -C bare1 worktree add --detach ../there master &&
98 + git -C bare1 worktree add --detach ../there main &&
99 echo "worktree $(pwd)/bare1" >expect &&
100 echo "bare" >>expect &&
101 echo >>expect &&
@@ -109,7 +109,7 @@ test_expect_success '"list" all worktrees --porcelain from bare main' '
109
110 test_expect_success '"list" all worktrees from linked with a bare main' '
111 test_when_finished "rm -rf there out actual expect && git -C bare1 worktree prune" &&
112 - git -C bare1 worktree add --detach ../there master &&
112 + git -C bare1 worktree add --detach ../there main &&
113 echo "$(pwd)/bare1 (bare)" >expect &&
114 echo "$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)" >>expect &&
115 git -C there worktree list >out &&
t/t2405-worktree-submodule.sh
+4 -4
@@ -2,7 +2,7 @@
2
3 test_description='Combination of submodules and multiple worktrees'
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,7 +34,7 @@ test_expect_success 'add superproject worktree' '
34 '
35
36 test_expect_failure 'submodule is checked out just after worktree add' '
37 - git -C worktree diff --submodule master"^!" >out &&
37 + git -C worktree diff --submodule main"^!" >out &&
38 grep "file1 updated" out
39 '
40
@@ -44,7 +44,7 @@ test_expect_success 'add superproject worktree and initialize submodules' '
44 '
45
46 test_expect_success 'submodule is checked out just after submodule update in linked worktree' '
47 - git -C worktree-submodule-update diff --submodule master"^!" >out &&
47 + git -C worktree-submodule-update diff --submodule main"^!" >out &&
48 grep "file1 updated" out
49 '
50
@@ -54,7 +54,7 @@ test_expect_success 'add superproject worktree and manually add submodule worktr
54 '
55
56 test_expect_success 'submodule is checked out after manually adding submodule worktree' '
57 - git -C linked_submodule diff --submodule master"^!" >out &&
57 + git -C linked_submodule diff --submodule main"^!" >out &&
58 grep "file1 updated" out
59 '
60