t55[23]*: adjust the references to the default branch name "main"
Carefully excluding t5526, which sees independent development elsewhere at the time of writing, we use `main` as the default branch name in t55[23]*. 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/naster/nain/g' -- \ t55[23]*.sh && git checkout HEAD -- t5526\*) Note that t5533 contains a variation of the name `master` (`naster`) that we rename here, too. This commit allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main` for that range of 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
3ac8f6301ee9d4bf3f9e58b3ef12ba536005cb9d
13 files changed
+307
-307
t/t5520-pull.sh
+16
-16
@@ -2,7 +2,7 @@
2
3
test_description='pulling into void'
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
@@ -51,11 +51,11 @@ test_expect_success 'pulling into void' '
51
test_cmp file cloned/file
52
'
53
54
-test_expect_success 'pulling into void using master:master' '
54
+test_expect_success 'pulling into void using main:main' '
55
git init cloned-uho &&
56
(
57
cd cloned-uho &&
58
- git pull .. master:master
58
+ git pull .. main:main
59
) &&
60
test_path_is_file file &&
61
test_path_is_file cloned-uho/file &&
@@ -67,7 +67,7 @@ test_expect_success 'pulling into void does not overwrite untracked files' '
67
(
68
cd cloned-untracked &&
69
echo untracked >file &&
70
- test_must_fail git pull .. master &&
70
+ test_must_fail git pull .. main &&
71
echo untracked >expect &&
72
test_cmp expect file
73
)
@@ -79,7 +79,7 @@ test_expect_success 'pulling into void does not overwrite staged files' '
79
cd cloned-staged-colliding &&
80
echo "alternate content" >file &&
81
git add file &&
82
- test_must_fail git pull .. master &&
82
+ test_must_fail git pull .. main &&
83
echo "alternate content" >expect &&
84
test_cmp expect file &&
85
git cat-file blob :file >file.index &&
@@ -93,7 +93,7 @@ test_expect_success 'pulling into void does not remove new staged files' '
93
cd cloned-staged-new &&
94
echo "new tracked file" >newfile &&
95
git add newfile &&
96
- git pull .. master &&
96
+ git pull .. main &&
97
echo "new tracked file" >expect &&
98
test_cmp expect newfile &&
99
git cat-file blob :newfile >newfile.index &&
@@ -105,15 +105,15 @@ test_expect_success 'pulling into void must not create an octopus' '
105
git init cloned-octopus &&
106
(
107
cd cloned-octopus &&
108
- test_must_fail git pull .. master master &&
108
+ test_must_fail git pull .. main main &&
109
test_path_is_missing file
110
)
111
'
112
113
test_expect_success 'test . as a remote' '
114
- git branch copy master &&
114
+ git branch copy main &&
115
git config branch.copy.remote . &&
116
- git config branch.copy.merge refs/heads/master &&
116
+ git config branch.copy.merge refs/heads/main &&
117
echo updated >file &&
118
git commit -a -m updated &&
119
git checkout copy &&
@@ -129,7 +129,7 @@ test_expect_success 'test . as a remote' '
129
'
130
131
test_expect_success 'the default remote . should not break explicit pull' '
132
- git checkout -b second master^ &&
132
+ git checkout -b second main^ &&
133
echo modified >file &&
134
git commit -a -m modified &&
135
git checkout copy &&
@@ -364,7 +364,7 @@ test_expect_success 'failed --rebase shows advice' '
364
365
test_expect_success '--rebase fails with multiple branches' '
366
git reset --hard before-rebase &&
367
- test_must_fail git pull --rebase . copy master 2>err &&
367
+ test_must_fail git pull --rebase . copy main 2>err &&
368
test_cmp_rev HEAD before-rebase &&
369
test_i18ngrep "Cannot rebase onto multiple branches" err &&
370
echo modified >expect &&
@@ -503,7 +503,7 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '
503
test_i18ngrep ! "verify-signatures" err
504
'
505
506
-# add a feature branch, keep-merge, that is merged into master, so the
506
+# add a feature branch, keep-merge, that is merged into main, so the
507
# test can try preserving the merge commit (or not) with various
508
# --rebase flags/pull.rebase settings.
509
test_expect_success 'preserve merge setup' '
@@ -702,12 +702,12 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '
702
'
703
704
test_expect_success 'pull --rebase works on branch yet to be born' '
705
- git rev-parse master >expect &&
705
+ git rev-parse main >expect &&
706
mkdir empty_repo &&
707
(
708
cd empty_repo &&
709
git init &&
710
- git pull --rebase .. master &&
710
+ git pull --rebase .. main &&
711
git rev-parse HEAD >../actual
712
) &&
713
test_cmp expect actual
@@ -723,7 +723,7 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '
723
echo staged-file >expect &&
724
git ls-files >actual &&
725
test_cmp expect actual &&
726
- test_must_fail git pull --rebase .. master 2>err &&
726
+ test_must_fail git pull --rebase .. main 2>err &&
727
git ls-files >actual &&
728
test_cmp expect actual &&
729
git show :staged-file >actual &&
@@ -782,7 +782,7 @@ test_expect_success 'setup for avoiding reapplying old patches' '
782
(
783
cd dst &&
784
test_might_fail git rebase --abort &&
785
- git reset --hard origin/master
785
+ git reset --hard origin/main
786
) &&
787
git clone --bare src src-replace.git &&
788
rm -rf src &&
t/t5521-pull-options.sh
+9
-9
@@ -2,7 +2,7 @@
2
3
test_description='pull 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
@@ -102,13 +102,13 @@ test_expect_success 'git pull --force' '
102
cat >>.git/config <<-\EOF &&
103
[remote "one"]
104
url = ../parent
105
- fetch = refs/heads/master:refs/heads/mirror
105
+ fetch = refs/heads/main:refs/heads/mirror
106
[remote "two"]
107
url = ../parent
108
- fetch = refs/heads/master:refs/heads/origin
109
- [branch "master"]
108
+ fetch = refs/heads/main:refs/heads/origin
109
+ [branch "main"]
110
remote = two
111
- merge = refs/heads/master
111
+ merge = refs/heads/main
112
EOF
113
git pull two &&
114
test_commit A &&
@@ -127,9 +127,9 @@ test_expect_success 'git pull --all' '
127
[remote "two"]
128
url = ../parent
129
fetch = refs/heads/*:refs/remotes/two/*
130
- [branch "master"]
130
+ [branch "main"]
131
remote = one
132
- merge = refs/heads/master
132
+ merge = refs/heads/main
133
EOF
134
git pull --all
135
)
@@ -142,7 +142,7 @@ test_expect_success 'git pull --dry-run' '
142
cd clonedry &&
143
git pull --dry-run ../parent &&
144
test_path_is_missing .git/FETCH_HEAD &&
145
- test_path_is_missing .git/refs/heads/master &&
145
+ test_path_is_missing .git/refs/heads/main &&
146
test_path_is_missing .git/index &&
147
test_path_is_missing file
148
)
@@ -156,7 +156,7 @@ test_expect_success 'git pull --all --dry-run' '
156
git remote add origin ../parent &&
157
git pull --all --dry-run &&
158
test_path_is_missing .git/FETCH_HEAD &&
159
- test_path_is_missing .git/refs/remotes/origin/master &&
159
+ test_path_is_missing .git/refs/remotes/origin/main &&
160
test_path_is_missing .git/index &&
161
test_path_is_missing file
162
)
t/t5523-push-upstream.sh
+16
-16
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='push with --set-upstream'
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,19 +29,19 @@ check_config() {
29
test_cmp expect.$1 actual.$1
30
}
31
32
-test_expect_success 'push -u master:master' '
33
- git push -u upstream master:master &&
34
- check_config master upstream refs/heads/master
32
+test_expect_success 'push -u main:main' '
33
+ git push -u upstream main:main &&
34
+ check_config main upstream refs/heads/main
35
'
36
37
-test_expect_success 'push -u master:other' '
38
- git push -u upstream master:other &&
39
- check_config master upstream refs/heads/other
37
+test_expect_success 'push -u main:other' '
38
+ git push -u upstream main:other &&
39
+ check_config main upstream refs/heads/other
40
'
41
42
-test_expect_success 'push -u --dry-run master:otherX' '
43
- git push -u --dry-run upstream master:otherX &&
44
- check_config master upstream refs/heads/other
42
+test_expect_success 'push -u --dry-run main:otherX' '
43
+ git push -u --dry-run upstream main:otherX &&
44
+ check_config main upstream refs/heads/other
45
'
46
47
test_expect_success 'push -u topic_2:topic_2' '
@@ -77,7 +77,7 @@ test_expect_success 'push -u HEAD' '
77
test_expect_success TTY 'progress messages go to tty' '
78
ensure_fresh_upstream &&
79
80
- test_terminal git push -u upstream master >out 2>err &&
80
+ test_terminal git push -u upstream main >out 2>err &&
81
test_i18ngrep "Writing objects" err
82
'
83
@@ -85,7 +85,7 @@ test_expect_success 'progress messages do not go to non-tty' '
85
ensure_fresh_upstream &&
86
87
# skip progress messages, since stderr is non-tty
88
- git push -u upstream master >out 2>err &&
88
+ git push -u upstream main >out 2>err &&
89
test_i18ngrep ! "Writing objects" err
90
'
91
@@ -93,21 +93,21 @@ test_expect_success 'progress messages go to non-tty (forced)' '
93
ensure_fresh_upstream &&
94
95
# force progress messages to stderr, even though it is non-tty
96
- git push -u --progress upstream master >out 2>err &&
96
+ git push -u --progress upstream main >out 2>err &&
97
test_i18ngrep "Writing objects" err
98
'
99
100
test_expect_success TTY 'push -q suppresses progress' '
101
ensure_fresh_upstream &&
102
103
- test_terminal git push -u -q upstream master >out 2>err &&
103
+ test_terminal git push -u -q upstream main >out 2>err &&
104
test_i18ngrep ! "Writing objects" err
105
'
106
107
test_expect_success TTY 'push --no-progress suppresses progress' '
108
ensure_fresh_upstream &&
109
110
- test_terminal git push -u --no-progress upstream master >out 2>err &&
110
+ test_terminal git push -u --no-progress upstream main >out 2>err &&
111
test_i18ngrep ! "Unpacking objects" err &&
112
test_i18ngrep ! "Writing objects" err
113
'
@@ -115,7 +115,7 @@ test_expect_success TTY 'push --no-progress suppresses progress' '
115
test_expect_success TTY 'quiet push' '
116
ensure_fresh_upstream &&
117
118
- test_terminal git push --quiet --no-progress upstream master 2>&1 | tee output &&
118
+ test_terminal git push --quiet --no-progress upstream main 2>&1 | tee output &&
119
test_must_be_empty output
120
'
121
t/t5527-fetch-odd-refs.sh
+8
-8
@@ -1,20 +1,20 @@
1
#!/bin/sh
2
3
test_description='test fetching of oddly-named refs'
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
# afterwards we will have:
10
# HEAD - two
11
-# refs/for/refs/heads/master - one
12
-# refs/heads/master - three
11
+# refs/for/refs/heads/main - one
12
+# refs/heads/main - three
13
test_expect_success 'setup repo with odd suffix ref' '
14
echo content >file &&
15
git add . &&
16
git commit -m one &&
17
- git update-ref refs/for/refs/heads/master HEAD &&
17
+ git update-ref refs/for/refs/heads/main HEAD &&
18
echo content >>file &&
19
git commit -a -m two &&
20
echo content >>file &&
@@ -25,7 +25,7 @@ test_expect_success 'setup repo with odd suffix ref' '
25
test_expect_success 'suffix ref is ignored during fetch' '
26
git clone --bare file://"$PWD" suffix &&
27
echo three >expect &&
28
- git --git-dir=suffix log -1 --format=%s refs/heads/master >actual &&
28
+ git --git-dir=suffix log -1 --format=%s refs/heads/main >actual &&
29
test_cmp expect actual
30
'
31
@@ -36,7 +36,7 @@ test_expect_success 'try to create repo with absurdly long refname' '
36
(
37
cd long &&
38
test_commit long &&
39
- test_commit master
39
+ test_commit main
40
) &&
41
if git -C long update-ref refs/heads/$ref1440 long; then
42
test_set_prereq LONG_REF
@@ -49,7 +49,7 @@ test_expect_success LONG_REF 'fetch handles extremely long refname' '
49
git fetch long refs/heads/*:refs/remotes/long/* &&
50
cat >expect <<-\EOF &&
51
long
52
- master
52
+ main
53
EOF
54
git for-each-ref --format="%(subject)" refs/remotes/long >actual &&
55
test_cmp expect actual
@@ -58,7 +58,7 @@ test_expect_success LONG_REF 'fetch handles extremely long refname' '
58
test_expect_success LONG_REF 'push handles extremely long refname' '
59
git push long :refs/heads/$ref1440 &&
60
git -C long for-each-ref --format="%(subject)" refs/heads >actual &&
61
- echo master >expect &&
61
+ echo main >expect &&
62
test_cmp expect actual
63
'
64
t/t5528-push-default.sh
+50
-50
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
3
test_description='check various push.default settings'
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
@@ -44,7 +44,7 @@ test_push_failure () {
44
45
# $1 = success or failure
46
# $2 = push.default value
47
-# $3 = branch to check for actual output (master or foo)
47
+# $3 = branch to check for actual output (main or foo)
48
# $4 = [optional] switch to triangular workflow
49
test_pushdefault_workflow () {
50
workflow=central
@@ -54,8 +54,8 @@ test_pushdefault_workflow () {
54
pushdefault=parent2
55
fi
56
test_expect_success "push.default = $2 $1 in $workflow workflows" "
57
- test_config branch.master.remote parent1 &&
58
- test_config branch.master.merge refs/heads/foo &&
57
+ test_config branch.main.remote parent1 &&
58
+ test_config branch.main.merge refs/heads/foo &&
59
test_config remote.pushdefault $pushdefault &&
60
test_commit commit-for-$2${4+-triangular} &&
61
test_push_$1 $2 $3 ${4+repo2}
@@ -63,32 +63,32 @@ test_pushdefault_workflow () {
63
}
64
65
test_expect_success '"upstream" pushes to configured upstream' '
66
- git checkout master &&
67
- test_config branch.master.remote parent1 &&
68
- test_config branch.master.merge refs/heads/foo &&
66
+ git checkout main &&
67
+ test_config branch.main.remote parent1 &&
68
+ test_config branch.main.merge refs/heads/foo &&
69
test_commit two &&
70
test_push_success upstream foo
71
'
72
73
test_expect_success '"upstream" does not push on unconfigured remote' '
74
- git checkout master &&
75
- test_unconfig branch.master.remote &&
74
+ git checkout main &&
75
+ test_unconfig branch.main.remote &&
76
test_commit three &&
77
test_push_failure upstream
78
'
79
80
test_expect_success '"upstream" does not push on unconfigured branch' '
81
- git checkout master &&
82
- test_config branch.master.remote parent1 &&
83
- test_unconfig branch.master.merge &&
81
+ git checkout main &&
82
+ test_config branch.main.remote parent1 &&
83
+ test_unconfig branch.main.merge &&
84
test_commit four &&
85
test_push_failure upstream
86
'
87
88
test_expect_success '"upstream" does not push when remotes do not match' '
89
- git checkout master &&
90
- test_config branch.master.remote parent1 &&
91
- test_config branch.master.merge refs/heads/foo &&
89
+ git checkout main &&
90
+ test_config branch.main.remote parent1 &&
91
+ test_config branch.main.merge refs/heads/foo &&
92
test_config push.default upstream &&
93
test_commit five &&
94
test_must_fail git push parent2
@@ -124,99 +124,99 @@ test_expect_success 'push from/to new branch with current creates remote branch'
124
'
125
126
test_expect_success 'push to existing branch, with no upstream configured' '
127
- test_config branch.master.remote repo1 &&
128
- git checkout master &&
127
+ test_config branch.main.remote repo1 &&
128
+ git checkout main &&
129
test_push_failure simple &&
130
test_push_failure upstream
131
'
132
133
test_expect_success 'push to existing branch, upstream configured with same name' '
134
- test_config branch.master.remote repo1 &&
135
- test_config branch.master.merge refs/heads/master &&
136
- git checkout master &&
134
+ test_config branch.main.remote repo1 &&
135
+ test_config branch.main.merge refs/heads/main &&
136
+ git checkout main &&
137
test_commit six &&
138
- test_push_success upstream master &&
138
+ test_push_success upstream main &&
139
test_commit seven &&
140
- test_push_success simple master
140
+ test_push_success simple main
141
'
142
143
test_expect_success 'push to existing branch, upstream configured with different name' '
144
- test_config branch.master.remote repo1 &&
145
- test_config branch.master.merge refs/heads/other-name &&
146
- git checkout master &&
144
+ test_config branch.main.remote repo1 &&
145
+ test_config branch.main.merge refs/heads/other-name &&
146
+ git checkout main &&
147
test_commit eight &&
148
test_push_success upstream other-name &&
149
test_commit nine &&
150
test_push_failure simple &&
151
git --git-dir=repo1 log -1 --format="%h %s" "other-name" >expect-other-name &&
152
- test_push_success current master &&
152
+ test_push_success current main &&
153
git --git-dir=repo1 log -1 --format="%h %s" "other-name" >actual-other-name &&
154
test_cmp expect-other-name actual-other-name
155
'
156
157
-# We are on 'master', which integrates with 'foo' from parent1
157
+# We are on 'main', which integrates with 'foo' from parent1
158
# remote (set in test_pushdefault_workflow helper). Push to
159
# parent1 in centralized, and push to parent2 in triangular workflow.
160
-# The parent1 repository has 'master' and 'foo' branches, while
161
-# the parent2 repository has only 'master' branch.
160
+# The parent1 repository has 'main' and 'foo' branches, while
161
+# the parent2 repository has only 'main' branch.
162
#
163
# test_pushdefault_workflow() arguments:
164
# $1 = success or failure
165
# $2 = push.default value
166
-# $3 = branch to check for actual output (master or foo)
166
+# $3 = branch to check for actual output (main or foo)
167
# $4 = [optional] switch to triangular workflow
168
169
-# update parent1's master (which is not our upstream)
170
-test_pushdefault_workflow success current master
169
+# update parent1's main (which is not our upstream)
170
+test_pushdefault_workflow success current main
171
172
# update parent1's foo (which is our upstream)
173
test_pushdefault_workflow success upstream foo
174
175
# upstream is foo which is not the name of the current branch
176
-test_pushdefault_workflow failure simple master
176
+test_pushdefault_workflow failure simple main
177
178
-# master and foo are updated
179
-test_pushdefault_workflow success matching master
178
+# main and foo are updated
179
+test_pushdefault_workflow success matching main
180
181
-# master is updated
182
-test_pushdefault_workflow success current master triangular
181
+# main is updated
182
+test_pushdefault_workflow success current main triangular
183
184
# upstream mode cannot be used in triangular
185
test_pushdefault_workflow failure upstream foo triangular
186
187
# in triangular, 'simple' works as 'current' and update the branch
188
# with the same name.
189
-test_pushdefault_workflow success simple master triangular
189
+test_pushdefault_workflow success simple main triangular
190
191
-# master is updated (parent2 does not have foo)
192
-test_pushdefault_workflow success matching master triangular
191
+# main is updated (parent2 does not have foo)
192
+test_pushdefault_workflow success matching main triangular
193
194
# default tests, when no push-default is specified. This
195
# should behave the same as "simple" in non-triangular
196
# settings, and as "current" otherwise.
197
198
test_expect_success 'default behavior allows "simple" push' '
199
- test_config branch.master.remote parent1 &&
200
- test_config branch.master.merge refs/heads/master &&
199
+ test_config branch.main.remote parent1 &&
200
+ test_config branch.main.merge refs/heads/main &&
201
test_config remote.pushdefault parent1 &&
202
- test_commit default-master-master &&
203
- test_push_success "" master
202
+ test_commit default-main-main &&
203
+ test_push_success "" main
204
'
205
206
test_expect_success 'default behavior rejects non-simple push' '
207
- test_config branch.master.remote parent1 &&
208
- test_config branch.master.merge refs/heads/foo &&
207
+ test_config branch.main.remote parent1 &&
208
+ test_config branch.main.merge refs/heads/foo &&
209
test_config remote.pushdefault parent1 &&
210
- test_commit default-master-foo &&
210
+ test_commit default-main-foo &&
211
test_push_failure ""
212
'
213
214
test_expect_success 'default triangular behavior acts like "current"' '
215
- test_config branch.master.remote parent1 &&
216
- test_config branch.master.merge refs/heads/foo &&
215
+ test_config branch.main.remote parent1 &&
216
+ test_config branch.main.merge refs/heads/foo &&
217
test_config remote.pushdefault parent2 &&
218
test_commit default-triangular &&
219
- test_push_success "" master repo2
219
+ test_push_success "" main repo2
220
'
221
222
test_done
t/t5529-push-errors.sh
+1
-1
@@ -32,7 +32,7 @@ test_expect_success 'detect missing branches early' '
32
test_expect_success 'detect missing sha1 expressions early' '
33
echo no >rp-ran &&
34
echo no >expect &&
35
- test_must_fail git push origin master~2:master &&
35
+ test_must_fail git push origin main~2:main &&
36
test_cmp expect rp-ran
37
'
38
t/t5530-upload-pack-error.sh
+1
-1
@@ -115,7 +115,7 @@ test_expect_success 'create empty repository' '
115
116
test_expect_success 'fetch fails' '
117
118
- test_must_fail git fetch .. master
118
+ test_must_fail git fetch .. main
119
120
'
121
t/t5531-deep-submodule-push.sh
+95
-95
@@ -2,7 +2,7 @@
2
3
test_description='test push with submodules'
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
@@ -33,7 +33,7 @@ test_expect_success setup '
33
test_expect_success 'push works with recorded gitlink' '
34
(
35
cd work &&
36
- git push ../pub.git master
36
+ git push ../pub.git main
37
)
38
'
39
@@ -48,7 +48,7 @@ test_expect_success 'push if submodule has no remote' '
48
cd work &&
49
git add gar/bage &&
50
git commit -m "Second commit for gar/bage" &&
51
- git push --recurse-submodules=check ../pub.git master
51
+ git push --recurse-submodules=check ../pub.git main
52
)
53
'
54
@@ -69,21 +69,21 @@ test_expect_success 'push fails if submodule commit not on remote' '
69
git commit -m "Third commit for gar/bage" &&
70
# the push should fail with --recurse-submodules=check
71
# on the command line...
72
- test_must_fail git push --recurse-submodules=check ../pub.git master &&
72
+ test_must_fail git push --recurse-submodules=check ../pub.git main &&
73
74
# ...or if specified in the configuration..
75
- test_must_fail git -c push.recurseSubmodules=check push ../pub.git master
75
+ test_must_fail git -c push.recurseSubmodules=check push ../pub.git main
76
)
77
'
78
79
test_expect_success 'push succeeds after commit was pushed to remote' '
80
(
81
cd work/gar/bage &&
82
- git push origin master
82
+ git push origin main
83
) &&
84
(
85
cd work &&
86
- git push --recurse-submodules=check ../pub.git master
86
+ git push --recurse-submodules=check ../pub.git main
87
)
88
'
89
@@ -98,13 +98,13 @@ test_expect_success 'push succeeds if submodule commit not on remote but using o
98
cd work &&
99
git add gar/bage &&
100
git commit -m "Recurse on-demand on command line for gar/bage" &&
101
- git push --recurse-submodules=on-demand ../pub.git master &&
101
+ git push --recurse-submodules=on-demand ../pub.git main &&
102
# Check that the supermodule commit got there
103
git fetch ../pub.git &&
104
- git diff --quiet FETCH_HEAD master &&
104
+ git diff --quiet FETCH_HEAD main &&
105
# Check that the submodule commit got there too
106
cd gar/bage &&
107
- git diff --quiet origin/master master
107
+ git diff --quiet origin/main main
108
)
109
'
110
@@ -119,13 +119,13 @@ test_expect_success 'push succeeds if submodule commit not on remote but using o
119
cd work &&
120
git add gar/bage &&
121
git commit -m "Recurse on-demand from config for gar/bage" &&
122
- git -c push.recurseSubmodules=on-demand push ../pub.git master &&
122
+ git -c push.recurseSubmodules=on-demand push ../pub.git main &&
123
# Check that the supermodule commit got there
124
git fetch ../pub.git &&
125
- git diff --quiet FETCH_HEAD master &&
125
+ git diff --quiet FETCH_HEAD main &&
126
# Check that the submodule commit got there too
127
cd gar/bage &&
128
- git diff --quiet origin/master master
128
+ git diff --quiet origin/main main
129
)
130
'
131
@@ -140,13 +140,13 @@ test_expect_success 'push succeeds if submodule commit not on remote but using a
140
cd work &&
141
git add gar/bage &&
142
git commit -m "Recurse submodule.recurse from config for gar/bage" &&
143
- git -c submodule.recurse push ../pub.git master &&
143
+ git -c submodule.recurse push ../pub.git main &&
144
# Check that the supermodule commit got there
145
git fetch ../pub.git &&
146
- git diff --quiet FETCH_HEAD master &&
146
+ git diff --quiet FETCH_HEAD main &&
147
# Check that the submodule commit got there too
148
cd gar/bage &&
149
- git diff --quiet origin/master master
149
+ git diff --quiet origin/main main
150
)
151
'
152
@@ -164,34 +164,34 @@ test_expect_success 'push recurse-submodules on command line overrides config' '
164
165
# Ensure that we can override on-demand in the config
166
# to just check submodules
167
- test_must_fail git -c push.recurseSubmodules=on-demand push --recurse-submodules=check ../pub.git master &&
167
+ test_must_fail git -c push.recurseSubmodules=on-demand push --recurse-submodules=check ../pub.git main &&
168
# Check that the supermodule commit did not get there
169
git fetch ../pub.git &&
170
- git diff --quiet FETCH_HEAD master^ &&
170
+ git diff --quiet FETCH_HEAD main^ &&
171
# Check that the submodule commit did not get there
172
- (cd gar/bage && git diff --quiet origin/master master^) &&
172
+ (cd gar/bage && git diff --quiet origin/main main^) &&
173
174
# Ensure that we can override check in the config to
175
# disable submodule recursion entirely
176
- (cd gar/bage && git diff --quiet origin/master master^) &&
177
- git -c push.recurseSubmodules=on-demand push --recurse-submodules=no ../pub.git master &&
176
+ (cd gar/bage && git diff --quiet origin/main main^) &&
177
+ git -c push.recurseSubmodules=on-demand push --recurse-submodules=no ../pub.git main &&
178
git fetch ../pub.git &&
179
- git diff --quiet FETCH_HEAD master &&
180
- (cd gar/bage && git diff --quiet origin/master master^) &&
179
+ git diff --quiet FETCH_HEAD main &&
180
+ (cd gar/bage && git diff --quiet origin/main main^) &&
181
182
# Ensure that we can override check in the config to
183
# disable submodule recursion entirely (alternative form)
184
- git -c push.recurseSubmodules=on-demand push --no-recurse-submodules ../pub.git master &&
184
+ git -c push.recurseSubmodules=on-demand push --no-recurse-submodules ../pub.git main &&
185
git fetch ../pub.git &&
186
- git diff --quiet FETCH_HEAD master &&
187
- (cd gar/bage && git diff --quiet origin/master master^) &&
186
+ git diff --quiet FETCH_HEAD main &&
187
+ (cd gar/bage && git diff --quiet origin/main main^) &&
188
189
# Ensure that we can override check in the config to
190
# push the submodule too
191
- git -c push.recurseSubmodules=check push --recurse-submodules=on-demand ../pub.git master &&
191
+ git -c push.recurseSubmodules=check push --recurse-submodules=on-demand ../pub.git main &&
192
git fetch ../pub.git &&
193
- git diff --quiet FETCH_HEAD master &&
194
- (cd gar/bage && git diff --quiet origin/master master)
193
+ git diff --quiet FETCH_HEAD main &&
194
+ (cd gar/bage && git diff --quiet origin/main main)
195
)
196
'
197
@@ -208,31 +208,31 @@ test_expect_success 'push recurse-submodules last one wins on command line' '
208
git commit -m "Recurse on command-line overriding earlier command-line for gar/bage" &&
209
210
# should result in "check"
211
- test_must_fail git push --recurse-submodules=on-demand --recurse-submodules=check ../pub.git master &&
211
+ test_must_fail git push --recurse-submodules=on-demand --recurse-submodules=check ../pub.git main &&
212
# Check that the supermodule commit did not get there
213
git fetch ../pub.git &&
214
- git diff --quiet FETCH_HEAD master^ &&
214
+ git diff --quiet FETCH_HEAD main^ &&
215
# Check that the submodule commit did not get there
216
- (cd gar/bage && git diff --quiet origin/master master^) &&
216
+ (cd gar/bage && git diff --quiet origin/main main^) &&
217
218
# should result in "no"
219
- git push --recurse-submodules=on-demand --recurse-submodules=no ../pub.git master &&
219
+ git push --recurse-submodules=on-demand --recurse-submodules=no ../pub.git main &&
220
# Check that the supermodule commit did get there
221
git fetch ../pub.git &&
222
- git diff --quiet FETCH_HEAD master &&
222
+ git diff --quiet FETCH_HEAD main &&
223
# Check that the submodule commit did not get there
224
- (cd gar/bage && git diff --quiet origin/master master^) &&
224
+ (cd gar/bage && git diff --quiet origin/main main^) &&
225
226
# should result in "no"
227
- git push --recurse-submodules=on-demand --no-recurse-submodules ../pub.git master &&
227
+ git push --recurse-submodules=on-demand --no-recurse-submodules ../pub.git main &&
228
# Check that the submodule commit did not get there
229
- (cd gar/bage && git diff --quiet origin/master master^) &&
229
+ (cd gar/bage && git diff --quiet origin/main main^) &&
230
231
# But the options in the other order should push the submodule
232
- git push --recurse-submodules=check --recurse-submodules=on-demand ../pub.git master &&
232
+ git push --recurse-submodules=check --recurse-submodules=on-demand ../pub.git main &&
233
# Check that the submodule commit did get there
234
git fetch ../pub.git &&
235
- (cd gar/bage && git diff --quiet origin/master master)
235
+ (cd gar/bage && git diff --quiet origin/main main)
236
)
237
'
238
@@ -247,13 +247,13 @@ test_expect_success 'push succeeds if submodule commit not on remote using on-de
247
cd work &&
248
git add gar/bage &&
249
git commit -m "Recurse on-demand on command-line overriding config for gar/bage" &&
250
- git -c push.recurseSubmodules=check push --recurse-submodules=on-demand ../pub.git master &&
250
+ git -c push.recurseSubmodules=check push --recurse-submodules=on-demand ../pub.git main &&
251
# Check that the supermodule commit got there
252
git fetch ../pub.git &&
253
- git diff --quiet FETCH_HEAD master &&
253
+ git diff --quiet FETCH_HEAD main &&
254
# Check that the submodule commit got there
255
cd gar/bage &&
256
- git diff --quiet origin/master master
256
+ git diff --quiet origin/main main
257
)
258
'
259
@@ -268,14 +268,14 @@ test_expect_success 'push succeeds if submodule commit disabling recursion from
268
cd work &&
269
git add gar/bage &&
270
git commit -m "Recurse disable on command-line overriding config for gar/bage" &&
271
- git -c push.recurseSubmodules=check push --recurse-submodules=no ../pub.git master &&
271
+ git -c push.recurseSubmodules=check push --recurse-submodules=no ../pub.git main &&
272
# Check that the supermodule commit got there
273
git fetch ../pub.git &&
274
- git diff --quiet FETCH_HEAD master &&
274
+ git diff --quiet FETCH_HEAD main &&
275
# But that the submodule commit did not
276
- ( cd gar/bage && git diff --quiet origin/master master^ ) &&
276
+ ( cd gar/bage && git diff --quiet origin/main main^ ) &&
277
# Now push it to avoid confusing future tests
278
- git push --recurse-submodules=on-demand ../pub.git master
278
+ git push --recurse-submodules=on-demand ../pub.git main
279
)
280
'
281
@@ -290,14 +290,14 @@ test_expect_success 'push succeeds if submodule commit disabling recursion from
290
cd work &&
291
git add gar/bage &&
292
git commit -m "Recurse disable on command-line alternative overriding config for gar/bage" &&
293
- git -c push.recurseSubmodules=check push --no-recurse-submodules ../pub.git master &&
293
+ git -c push.recurseSubmodules=check push --no-recurse-submodules ../pub.git main &&
294
# Check that the supermodule commit got there
295
git fetch ../pub.git &&
296
- git diff --quiet FETCH_HEAD master &&
296
+ git diff --quiet FETCH_HEAD main &&
297
# But that the submodule commit did not
298
- ( cd gar/bage && git diff --quiet origin/master master^ ) &&
298
+ ( cd gar/bage && git diff --quiet origin/main main^ ) &&
299
# Now push it to avoid confusing future tests
300
- git push --recurse-submodules=on-demand ../pub.git master
300
+ git push --recurse-submodules=on-demand ../pub.git main
301
)
302
'
303
@@ -307,7 +307,7 @@ test_expect_success 'submodule entry pointing at a tag is error' '
307
git -C work update-index --cacheinfo 160000 "$tag" gar/bage &&
308
git -C work commit -m "bad commit" &&
309
test_when_finished "git -C work reset --hard HEAD^" &&
310
- test_must_fail git -C work push --recurse-submodules=on-demand ../pub.git master 2>err &&
310
+ test_must_fail git -C work push --recurse-submodules=on-demand ../pub.git main 2>err &&
311
test_i18ngrep "is a tag, not a commit" err
312
'
313
@@ -322,9 +322,9 @@ test_expect_success 'push fails if recurse submodules option passed as yes' '
322
cd work &&
323
git add gar/bage &&
324
git commit -m "Recurse push fails if recurse submodules option passed as yes for gar/bage" &&
325
- test_must_fail git push --recurse-submodules=yes ../pub.git master &&
326
- test_must_fail git -c push.recurseSubmodules=yes push ../pub.git master &&
327
- git push --recurse-submodules=on-demand ../pub.git master
325
+ test_must_fail git push --recurse-submodules=yes ../pub.git main &&
326
+ test_must_fail git -c push.recurseSubmodules=yes push ../pub.git main &&
327
+ git push --recurse-submodules=on-demand ../pub.git main
328
)
329
'
330
@@ -366,7 +366,7 @@ test_expect_success 'push succeeds if submodule has no remote and is on the firs
366
) &&
367
git add b &&
368
git commit -m "added submodule" &&
369
- git push --recurse-submodules=check origin master
369
+ git push --recurse-submodules=check origin main
370
)
371
'
372
@@ -375,21 +375,21 @@ test_expect_success 'push unpushed submodules when not needed' '
375
cd work &&
376
(
377
cd gar/bage &&
378
- git checkout master &&
378
+ git checkout main &&
379
>junk5 &&
380
git add junk5 &&
381
git commit -m "Fifth junk" &&
382
git push &&
383
- git rev-parse origin/master >../../../expected
383
+ git rev-parse origin/main >../../../expected
384
) &&
385
- git checkout master &&
385
+ git checkout main &&
386
git add gar/bage &&
387
git commit -m "Fifth commit for gar/bage" &&
388
- git push --recurse-submodules=on-demand ../pub.git master
388
+ git push --recurse-submodules=on-demand ../pub.git main
389
) &&
390
(
391
cd submodule.git &&
392
- git rev-parse master >../actual
392
+ git rev-parse main >../actual
393
) &&
394
test_cmp expected actual
395
'
@@ -397,7 +397,7 @@ test_expect_success 'push unpushed submodules when not needed' '
397
test_expect_success 'push unpushed submodules when not needed 2' '
398
(
399
cd submodule.git &&
400
- git rev-parse master >../expected
400
+ git rev-parse main >../expected
401
) &&
402
(
403
cd work &&
@@ -410,11 +410,11 @@ test_expect_success 'push unpushed submodules when not needed 2' '
410
>junk2 &&
411
git add junk2 &&
412
git commit -m "Second junk for work" &&
413
- git push --recurse-submodules=on-demand ../pub.git master
413
+ git push --recurse-submodules=on-demand ../pub.git main
414
) &&
415
(
416
cd submodule.git &&
417
- git rev-parse master >../actual
417
+ git rev-parse main >../actual
418
) &&
419
test_cmp expected actual
420
'
@@ -424,20 +424,20 @@ test_expect_success 'push unpushed submodules recursively' '
424
cd work &&
425
(
426
cd gar/bage &&
427
- git checkout master &&
427
+ git checkout main &&
428
> junk7 &&
429
git add junk7 &&
430
git commit -m "Seventh junk" &&
431
- git rev-parse master >../../../expected
431
+ git rev-parse main >../../../expected
432
) &&
433
- git checkout master &&
433
+ git checkout main &&
434
git add gar/bage &&
435
git commit -m "Seventh commit for gar/bage" &&
436
- git push --recurse-submodules=on-demand ../pub.git master
436
+ git push --recurse-submodules=on-demand ../pub.git main
437
) &&
438
(
439
cd submodule.git &&
440
- git rev-parse master >../actual
440
+ git rev-parse main >../actual
441
) &&
442
test_cmp expected actual
443
'
@@ -447,64 +447,64 @@ test_expect_success 'push unpushable submodule recursively fails' '
447
cd work &&
448
(
449
cd gar/bage &&
450
- git rev-parse origin/master >../../../expected &&
451
- git checkout master~0 &&
450
+ git rev-parse origin/main >../../../expected &&
451
+ git checkout main~0 &&
452
> junk8 &&
453
git add junk8 &&
454
git commit -m "Eighth junk"
455
) &&
456
git add gar/bage &&
457
git commit -m "Eighth commit for gar/bage" &&
458
- test_must_fail git push --recurse-submodules=on-demand ../pub.git master
458
+ test_must_fail git push --recurse-submodules=on-demand ../pub.git main
459
) &&
460
(
461
cd submodule.git &&
462
- git rev-parse master >../actual
462
+ git rev-parse main >../actual
463
) &&
464
- test_when_finished git -C work reset --hard master^ &&
464
+ test_when_finished git -C work reset --hard main^ &&
465
test_cmp expected actual
466
'
467
468
test_expect_success 'push --dry-run does not recursively update submodules' '
469
(
470
cd work/gar/bage &&
471
- git checkout master &&
472
- git rev-parse master >../../../expected_submodule &&
471
+ git checkout main &&
472
+ git rev-parse main >../../../expected_submodule &&
473
> junk9 &&
474
git add junk9 &&
475
git commit -m "Ninth junk" &&
476
477
# Go up to 'work' directory
478
cd ../.. &&
479
- git checkout master &&
480
- git rev-parse master >../expected_pub &&
479
+ git checkout main &&
480
+ git rev-parse main >../expected_pub &&
481
git add gar/bage &&
482
git commit -m "Ninth commit for gar/bage" &&
483
- git push --dry-run --recurse-submodules=on-demand ../pub.git master
483
+ git push --dry-run --recurse-submodules=on-demand ../pub.git main
484
) &&
485
- git -C submodule.git rev-parse master >actual_submodule &&
486
- git -C pub.git rev-parse master >actual_pub &&
485
+ git -C submodule.git rev-parse main >actual_submodule &&
486
+ git -C pub.git rev-parse main >actual_pub &&
487
test_cmp expected_pub actual_pub &&
488
test_cmp expected_submodule actual_submodule
489
'
490
491
test_expect_success 'push --dry-run does not recursively update submodules' '
492
- git -C work push --dry-run --recurse-submodules=only ../pub.git master &&
492
+ git -C work push --dry-run --recurse-submodules=only ../pub.git main &&
493
494
- git -C submodule.git rev-parse master >actual_submodule &&
495
- git -C pub.git rev-parse master >actual_pub &&
494
+ git -C submodule.git rev-parse main >actual_submodule &&
495
+ git -C pub.git rev-parse main >actual_pub &&
496
test_cmp expected_pub actual_pub &&
497
test_cmp expected_submodule actual_submodule
498
'
499
500
test_expect_success 'push only unpushed submodules recursively' '
501
- git -C work/gar/bage rev-parse master >expected_submodule &&
502
- git -C pub.git rev-parse master >expected_pub &&
501
+ git -C work/gar/bage rev-parse main >expected_submodule &&
502
+ git -C pub.git rev-parse main >expected_pub &&
503
504
- git -C work push --recurse-submodules=only ../pub.git master &&
504
+ git -C work push --recurse-submodules=only ../pub.git main &&
505
506
- git -C submodule.git rev-parse master >actual_submodule &&
507
- git -C pub.git rev-parse master >actual_pub &&
506
+ git -C submodule.git rev-parse main >actual_submodule &&
507
+ git -C pub.git rev-parse main >actual_pub &&
508
test_cmp expected_submodule actual_submodule &&
509
test_cmp expected_pub actual_pub
510
'
@@ -520,14 +520,14 @@ test_expect_success 'push propagating the remotes name to a submodule' '
520
git -C work commit -m "Tenth junk added to gar/bage" &&
521
522
# Fails when submodule does not have a matching remote
523
- test_must_fail git -C work push --recurse-submodules=on-demand pub master &&
523
+ test_must_fail git -C work push --recurse-submodules=on-demand pub main &&
524
# Succeeds when submodules has matching remote and refspec
525
- git -C work push --recurse-submodules=on-demand origin master &&
525
+ git -C work push --recurse-submodules=on-demand origin main &&
526
527
- git -C submodule.git rev-parse master >actual_submodule &&
528
- git -C pub.git rev-parse master >actual_pub &&
529
- git -C work/gar/bage rev-parse master >expected_submodule &&
530
- git -C work rev-parse master >expected_pub &&
527
+ git -C submodule.git rev-parse main >actual_submodule &&
528
+ git -C pub.git rev-parse main >actual_pub &&
529
+ git -C work/gar/bage rev-parse main >expected_submodule &&
530
+ git -C work rev-parse main >expected_pub &&
531
test_cmp expected_submodule actual_submodule &&
532
test_cmp expected_pub actual_pub
533
'
@@ -551,7 +551,7 @@ test_expect_success 'push propagating refspec to a submodule' '
551
test_must_fail git -C work push --recurse-submodules=on-demand origin \
552
HEAD:refs/heads/branch2 &&
553
554
- git -C work/gar/bage branch branch2 master &&
554
+ git -C work/gar/bage branch branch2 main &&
555
git -C work push --recurse-submodules=on-demand origin branch2 &&
556
557
git -C submodule.git rev-parse branch2 >actual_submodule &&
t/t5533-push-cas.sh
+72
-72
@@ -2,7 +2,7 @@
2
3
test_description='compare & swap push force/delete safety'
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
@@ -32,22 +32,22 @@ setup_src_dup_dst () {
32
(
33
cd dup &&
34
git fetch &&
35
- git merge origin/master &&
36
- git switch -c branch master~2 &&
35
+ git merge origin/main &&
36
+ git switch -c branch main~2 &&
37
test_commit D &&
38
test_commit E &&
39
git push origin --all
40
) &&
41
(
42
cd src &&
43
- git switch master &&
43
+ git switch main &&
44
git fetch --all &&
45
git branch branch --track origin/branch &&
46
- git rebase origin/master
46
+ git rebase origin/main
47
) &&
48
(
49
cd dup &&
50
- git switch master &&
50
+ git switch main &&
51
test_commit F &&
52
test_commit G &&
53
git switch branch &&
@@ -68,11 +68,11 @@ test_expect_success 'push to update (protected)' '
68
(
69
cd dst &&
70
test_commit D &&
71
- test_must_fail git push --force-with-lease=master:master origin master 2>err &&
71
+ test_must_fail git push --force-with-lease=main:main origin main 2>err &&
72
grep "stale info" err
73
) &&
74
- git ls-remote . refs/heads/master >expect &&
75
- git ls-remote src refs/heads/master >actual &&
74
+ git ls-remote . refs/heads/main >expect &&
75
+ git ls-remote src refs/heads/main >actual &&
76
test_cmp expect actual
77
'
78
@@ -81,11 +81,11 @@ test_expect_success 'push to update (protected, forced)' '
81
(
82
cd dst &&
83
test_commit D &&
84
- git push --force --force-with-lease=master:master origin master 2>err &&
84
+ git push --force --force-with-lease=main:main origin main 2>err &&
85
grep "forced update" err
86
) &&
87
- git ls-remote dst refs/heads/master >expect &&
88
- git ls-remote src refs/heads/master >actual &&
87
+ git ls-remote dst refs/heads/main >expect &&
88
+ git ls-remote src refs/heads/main >actual &&
89
test_cmp expect actual
90
'
91
@@ -93,20 +93,20 @@ test_expect_success 'push to update (protected, tracking)' '
93
setup_srcdst_basic &&
94
(
95
cd src &&
96
- git checkout master &&
96
+ git checkout main &&
97
test_commit D &&
98
git checkout HEAD^0
99
) &&
100
- git ls-remote src refs/heads/master >expect &&
100
+ git ls-remote src refs/heads/main >expect &&
101
(
102
cd dst &&
103
test_commit E &&
104
- git ls-remote . refs/remotes/origin/master >expect &&
105
- test_must_fail git push --force-with-lease=master origin master &&
106
- git ls-remote . refs/remotes/origin/master >actual &&
104
+ git ls-remote . refs/remotes/origin/main >expect &&
105
+ test_must_fail git push --force-with-lease=main origin main &&
106
+ git ls-remote . refs/remotes/origin/main >actual &&
107
test_cmp expect actual
108
) &&
109
- git ls-remote src refs/heads/master >actual &&
109
+ git ls-remote src refs/heads/main >actual &&
110
test_cmp expect actual
111
'
112
@@ -114,18 +114,18 @@ test_expect_success 'push to update (protected, tracking, forced)' '
114
setup_srcdst_basic &&
115
(
116
cd src &&
117
- git checkout master &&
117
+ git checkout main &&
118
test_commit D &&
119
git checkout HEAD^0
120
) &&
121
(
122
cd dst &&
123
test_commit E &&
124
- git ls-remote . refs/remotes/origin/master >expect &&
125
- git push --force --force-with-lease=master origin master
124
+ git ls-remote . refs/remotes/origin/main >expect &&
125
+ git push --force --force-with-lease=main origin main
126
) &&
127
- git ls-remote dst refs/heads/master >expect &&
128
- git ls-remote src refs/heads/master >actual &&
127
+ git ls-remote dst refs/heads/main >expect &&
128
+ git ls-remote src refs/heads/main >actual &&
129
test_cmp expect actual
130
'
131
@@ -134,10 +134,10 @@ test_expect_success 'push to update (allowed)' '
134
(
135
cd dst &&
136
test_commit D &&
137
- git push --force-with-lease=master:master^ origin master
137
+ git push --force-with-lease=main:main^ origin main
138
) &&
139
- git ls-remote dst refs/heads/master >expect &&
140
- git ls-remote src refs/heads/master >actual &&
139
+ git ls-remote dst refs/heads/main >expect &&
140
+ git ls-remote src refs/heads/main >actual &&
141
test_cmp expect actual
142
'
143
@@ -146,11 +146,11 @@ test_expect_success 'push to update (allowed, tracking)' '
146
(
147
cd dst &&
148
test_commit D &&
149
- git push --force-with-lease=master origin master 2>err &&
149
+ git push --force-with-lease=main origin main 2>err &&
150
! grep "forced update" err
151
) &&
152
- git ls-remote dst refs/heads/master >expect &&
153
- git ls-remote src refs/heads/master >actual &&
152
+ git ls-remote dst refs/heads/main >expect &&
153
+ git ls-remote src refs/heads/main >actual &&
154
test_cmp expect actual
155
'
156
@@ -160,22 +160,22 @@ test_expect_success 'push to update (allowed even though no-ff)' '
160
cd dst &&
161
git reset --hard HEAD^ &&
162
test_commit D &&
163
- git push --force-with-lease=master origin master 2>err &&
163
+ git push --force-with-lease=main origin main 2>err &&
164
grep "forced update" err
165
) &&
166
- git ls-remote dst refs/heads/master >expect &&
167
- git ls-remote src refs/heads/master >actual &&
166
+ git ls-remote dst refs/heads/main >expect &&
167
+ git ls-remote src refs/heads/main >actual &&
168
test_cmp expect actual
169
'
170
171
test_expect_success 'push to delete (protected)' '
172
setup_srcdst_basic &&
173
- git ls-remote src refs/heads/master >expect &&
173
+ git ls-remote src refs/heads/main >expect &&
174
(
175
cd dst &&
176
- test_must_fail git push --force-with-lease=master:master^ origin :master
176
+ test_must_fail git push --force-with-lease=main:main^ origin :main
177
) &&
178
- git ls-remote src refs/heads/master >actual &&
178
+ git ls-remote src refs/heads/main >actual &&
179
test_cmp expect actual
180
'
181
@@ -183,9 +183,9 @@ test_expect_success 'push to delete (protected, forced)' '
183
setup_srcdst_basic &&
184
(
185
cd dst &&
186
- git push --force --force-with-lease=master:master^ origin :master
186
+ git push --force --force-with-lease=main:main^ origin :main
187
) &&
188
- git ls-remote src refs/heads/master >actual &&
188
+ git ls-remote src refs/heads/main >actual &&
189
test_must_be_empty actual
190
'
191
@@ -193,10 +193,10 @@ test_expect_success 'push to delete (allowed)' '
193
setup_srcdst_basic &&
194
(
195
cd dst &&
196
- git push --force-with-lease=master origin :master 2>err &&
196
+ git push --force-with-lease=main origin :main 2>err &&
197
grep deleted err
198
) &&
199
- git ls-remote src refs/heads/master >actual &&
199
+ git ls-remote src refs/heads/main >actual &&
200
test_must_be_empty actual
201
'
202
@@ -204,12 +204,12 @@ test_expect_success 'cover everything with default force-with-lease (protected)'
204
setup_srcdst_basic &&
205
(
206
cd src &&
207
- git branch naster master^
207
+ git branch nain main^
208
) &&
209
git ls-remote src refs/heads/\* >expect &&
210
(
211
cd dst &&
212
- test_must_fail git push --force-with-lease origin master master:naster
212
+ test_must_fail git push --force-with-lease origin main main:nain
213
) &&
214
git ls-remote src refs/heads/\* >actual &&
215
test_cmp expect actual
@@ -219,16 +219,16 @@ test_expect_success 'cover everything with default force-with-lease (allowed)' '
219
setup_srcdst_basic &&
220
(
221
cd src &&
222
- git branch naster master^
222
+ git branch nain main^
223
) &&
224
(
225
cd dst &&
226
git fetch &&
227
- git push --force-with-lease origin master master:naster
227
+ git push --force-with-lease origin main main:nain
228
) &&
229
- git ls-remote dst refs/heads/master |
230
- sed -e "s/master/naster/" >expect &&
231
- git ls-remote src refs/heads/naster >actual &&
229
+ git ls-remote dst refs/heads/main |
230
+ sed -e "s/main/nain/" >expect &&
231
+ git ls-remote src refs/heads/nain >actual &&
232
test_cmp expect actual
233
'
234
@@ -236,7 +236,7 @@ test_expect_success 'new branch covered by force-with-lease' '
236
setup_srcdst_basic &&
237
(
238
cd dst &&
239
- git branch branch master &&
239
+ git branch branch main &&
240
git push --force-with-lease=branch origin branch
241
) &&
242
git ls-remote dst refs/heads/branch >expect &&
@@ -248,7 +248,7 @@ test_expect_success 'new branch covered by force-with-lease (explicit)' '
248
setup_srcdst_basic &&
249
(
250
cd dst &&
251
- git branch branch master &&
251
+ git branch branch main &&
252
git push --force-with-lease=branch: origin branch
253
) &&
254
git ls-remote dst refs/heads/branch >expect &&
@@ -260,12 +260,12 @@ test_expect_success 'new branch already exists' '
260
setup_srcdst_basic &&
261
(
262
cd src &&
263
- git checkout -b branch master &&
263
+ git checkout -b branch main &&
264
test_commit F
265
) &&
266
(
267
cd dst &&
268
- git branch branch master &&
268
+ git branch branch main &&
269
test_must_fail git push --force-with-lease=branch: origin branch
270
)
271
'
@@ -280,7 +280,7 @@ test_expect_success 'background updates of REMOTE can be mitigated with a non-up
280
cd dst &&
281
test_commit G &&
282
git remote add origin-push ../src.bare &&
283
- git push origin-push master:master
283
+ git push origin-push main:main
284
) &&
285
git clone --no-local src.bare dst2 &&
286
test_when_finished "rm -rf dst2" &&
@@ -302,58 +302,58 @@ test_expect_success 'background updates of REMOTE can be mitigated with a non-up
302
test_expect_success 'background updates to remote can be mitigated with "--force-if-includes"' '
303
setup_src_dup_dst &&
304
test_when_finished "rm -fr dst src dup" &&
305
- git ls-remote dst refs/heads/master >expect.master &&
305
+ git ls-remote dst refs/heads/main >expect.main &&
306
git ls-remote dst refs/heads/branch >expect.branch &&
307
(
308
cd src &&
309
git switch branch &&
310
test_commit I &&
311
- git switch master &&
311
+ git switch main &&
312
test_commit J &&
313
git fetch --all &&
314
test_must_fail git push --force-with-lease --force-if-includes --all
315
) &&
316
- git ls-remote dst refs/heads/master >actual.master &&
316
+ git ls-remote dst refs/heads/main >actual.main &&
317
git ls-remote dst refs/heads/branch >actual.branch &&
318
- test_cmp expect.master actual.master &&
318
+ test_cmp expect.main actual.main &&
319
test_cmp expect.branch actual.branch
320
'
321
322
test_expect_success 'background updates to remote can be mitigated with "push.useForceIfIncludes"' '
323
setup_src_dup_dst &&
324
test_when_finished "rm -fr dst src dup" &&
325
- git ls-remote dst refs/heads/master >expect.master &&
325
+ git ls-remote dst refs/heads/main >expect.main &&
326
(
327
cd src &&
328
git switch branch &&
329
test_commit I &&
330
- git switch master &&
330
+ git switch main &&
331
test_commit J &&
332
git fetch --all &&
333
git config --local push.useForceIfIncludes true &&
334
- test_must_fail git push --force-with-lease=master origin master
334
+ test_must_fail git push --force-with-lease=main origin main
335
) &&
336
- git ls-remote dst refs/heads/master >actual.master &&
337
- test_cmp expect.master actual.master
336
+ git ls-remote dst refs/heads/main >actual.main &&
337
+ test_cmp expect.main actual.main
338
'
339
340
test_expect_success '"--force-if-includes" should be disabled for --force-with-lease="<refname>:<expect>"' '
341
setup_src_dup_dst &&
342
test_when_finished "rm -fr dst src dup" &&
343
- git ls-remote dst refs/heads/master >expect.master &&
343
+ git ls-remote dst refs/heads/main >expect.main &&
344
(
345
cd src &&
346
git switch branch &&
347
test_commit I &&
348
- git switch master &&
348
+ git switch main &&
349
test_commit J &&
350
- remote_head="$(git rev-parse refs/remotes/origin/master)" &&
350
+ remote_head="$(git rev-parse refs/remotes/origin/main)" &&
351
git fetch --all &&
352
- test_must_fail git push --force-if-includes --force-with-lease="master:$remote_head" 2>err &&
352
+ test_must_fail git push --force-if-includes --force-with-lease="main:$remote_head" 2>err &&
353
grep "stale info" err
354
) &&
355
- git ls-remote dst refs/heads/master >actual.master &&
356
- test_cmp expect.master actual.master
355
+ git ls-remote dst refs/heads/main >actual.main &&
356
+ test_cmp expect.main actual.main
357
'
358
359
test_expect_success '"--force-if-includes" should allow forced update after a rebase ("pull --rebase")' '
@@ -363,10 +363,10 @@ test_expect_success '"--force-if-includes" should allow forced update after a re
363
cd src &&
364
git switch branch &&
365
test_commit I &&
366
- git switch master &&
366
+ git switch main &&
367
test_commit J &&
368
- git pull --rebase origin master &&
369
- git push --force-if-includes --force-with-lease="master"
368
+ git pull --rebase origin main &&
369
+ git push --force-if-includes --force-with-lease="main"
370
)
371
'
372
@@ -377,11 +377,11 @@ test_expect_success '"--force-if-includes" should allow forced update after a re
377
cd src &&
378
git switch branch &&
379
test_commit I &&
380
- git switch master &&
380
+ git switch main &&
381
test_commit J &&
382
- git pull --rebase origin master &&
382
+ git pull --rebase origin main &&
383
git rebase --onto HEAD~4 HEAD~1 &&
384
- git push --force-if-includes --force-with-lease="master"
384
+ git push --force-if-includes --force-with-lease="main"
385
)
386
'
387
t/t5534-push-signed.sh
+3
-3
@@ -2,7 +2,7 @@
2
3
test_description='signed push'
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
@@ -12,11 +12,11 @@ prepare_dst () {
12
rm -fr dst &&
13
test_create_repo dst &&
14
15
- git push dst master:noop master:ff master:noff
15
+ git push dst main:noop main:ff main:noff
16
}
17
18
test_expect_success setup '
19
- # master, ff and noff branches pointing at the same commit
19
+ # main, ff and noff branches pointing at the same commit
20
test_tick &&
21
git commit --allow-empty -m initial &&
22
t/t5537-fetch-shallow.sh
+16
-16
@@ -2,7 +2,7 @@
2
3
test_description='fetch/clone from a shallow clone'
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
@@ -52,7 +52,7 @@ test_expect_success 'fetch from shallow clone' '
52
cd shallow2 &&
53
git fetch &&
54
git fsck &&
55
- git log --format=%s origin/master >actual &&
55
+ git log --format=%s origin/main >actual &&
56
test_write_lines 5 4 3 >expect &&
57
test_cmp expect actual
58
)
@@ -67,7 +67,7 @@ test_expect_success 'fetch --depth from shallow clone' '
67
cd shallow2 &&
68
git fetch --depth=2 &&
69
git fsck &&
70
- git log --format=%s origin/master >actual &&
70
+ git log --format=%s origin/main >actual &&
71
test_write_lines 6 5 >expect &&
72
test_cmp expect actual
73
)
@@ -78,7 +78,7 @@ test_expect_success 'fetch --unshallow from shallow clone' '
78
cd shallow2 &&
79
git fetch --unshallow &&
80
git fsck &&
81
- git log --format=%s origin/master >actual &&
81
+ git log --format=%s origin/main >actual &&
82
test_write_lines 6 5 4 3 >expect &&
83
test_cmp expect actual
84
)
@@ -92,7 +92,7 @@ test_expect_success 'fetch --unshallow from a full clone' '
92
test_write_lines 4 3 >expect &&
93
test_cmp expect actual &&
94
git -c fetch.writeCommitGraph fetch --unshallow &&
95
- git log origin/master --format=%s >actual &&
95
+ git log origin/main --format=%s >actual &&
96
test_write_lines 4 3 2 1 >expect &&
97
test_cmp expect actual
98
)
@@ -107,9 +107,9 @@ test_expect_success 'fetch something upstream has but hidden by clients shallow
107
git commit -m add-1-back &&
108
(
109
cd shallow2 &&
110
- git fetch ../.git +refs/heads/master:refs/remotes/top/master &&
110
+ git fetch ../.git +refs/heads/main:refs/remotes/top/main &&
111
git fsck &&
112
- git log --format=%s top/master >actual &&
112
+ git log --format=%s top/main >actual &&
113
test_write_lines add-1-back 4 3 >expect &&
114
test_cmp expect actual
115
) &&
@@ -138,7 +138,7 @@ test_expect_success 'fetch that requires changes in .git/shallow is filtered' '
138
test_expect_success 'fetch --update-shallow' '
139
(
140
cd shallow &&
141
- git checkout master &&
141
+ git checkout main &&
142
commit 7 &&
143
git tag -m foo heavy-tag HEAD^ &&
144
git tag light-tag HEAD^:tracked
@@ -149,13 +149,13 @@ test_expect_success 'fetch --update-shallow' '
149
git fsck &&
150
git for-each-ref --sort=refname --format="%(refname)" >actual.refs &&
151
cat <<-\EOF >expect.refs &&
152
- refs/remotes/shallow/master
152
+ refs/remotes/shallow/main
153
refs/remotes/shallow/no-shallow
154
refs/tags/heavy-tag
155
refs/tags/light-tag
156
EOF
157
test_cmp expect.refs actual.refs &&
158
- git log --format=%s shallow/master >actual &&
158
+ git log --format=%s shallow/main >actual &&
159
test_write_lines 7 6 5 4 3 >expect &&
160
test_cmp expect actual
161
)
@@ -164,7 +164,7 @@ test_expect_success 'fetch --update-shallow' '
164
test_expect_success 'fetch --update-shallow (with fetch.writeCommitGraph)' '
165
(
166
cd shallow &&
167
- git checkout master &&
167
+ git checkout main &&
168
commit 8 &&
169
git tag -m foo heavy-tag-for-graph HEAD^ &&
170
git tag light-tag-for-graph HEAD^:tracked
@@ -176,7 +176,7 @@ test_expect_success 'fetch --update-shallow (with fetch.writeCommitGraph)' '
176
git fsck &&
177
git for-each-ref --sort=refname --format="%(refname)" >actual.refs &&
178
cat <<-EOF >expect.refs &&
179
- refs/remotes/shallow/master
179
+ refs/remotes/shallow/main
180
refs/remotes/shallow/no-shallow
181
refs/tags/heavy-tag
182
refs/tags/heavy-tag-for-graph
@@ -184,7 +184,7 @@ test_expect_success 'fetch --update-shallow (with fetch.writeCommitGraph)' '
184
refs/tags/light-tag-for-graph
185
EOF
186
test_cmp expect.refs actual.refs &&
187
- git log --format=%s shallow/master >actual &&
187
+ git log --format=%s shallow/main >actual &&
188
test_write_lines 8 7 6 5 4 3 >expect &&
189
test_cmp expect actual
190
)
@@ -209,7 +209,7 @@ test_expect_success '.git/shallow is edited by repack' '
209
test_commit -C shallow-server E &&
210
test_commit -C shallow-server D &&
211
d="$(git -C shallow-server rev-parse --verify D^0)" &&
212
- git -C shallow-server checkout master &&
212
+ git -C shallow-server checkout main &&
213
214
git clone --depth=1 --no-tags --no-single-branch \
215
"file://$PWD/shallow-server" shallow-client &&
@@ -247,7 +247,7 @@ test_expect_success 'shallow fetches check connectivity before writing shallow f
247
git -C "$REPO" config protocol.version 2 &&
248
git -C client config protocol.version 2 &&
249
250
- git -C client fetch --depth=2 "$HTTPD_URL/one_time_perl/repo" master:a_branch &&
250
+ git -C client fetch --depth=2 "$HTTPD_URL/one_time_perl/repo" main:a_branch &&
251
252
# Craft a situation in which the server sends back an unshallow request
253
# with an empty packfile. This is done by refetching with a shorter
@@ -259,7 +259,7 @@ test_expect_success 'shallow fetches check connectivity before writing shallow f
259
>"$HTTPD_ROOT_PATH/one-time-perl" &&
260
test_must_fail env GIT_TEST_SIDEBAND_ALL=0 git -C client \
261
fetch --depth=1 "$HTTPD_URL/one_time_perl/repo" \
262
- master:a_branch &&
262
+ main:a_branch &&
263
264
# Ensure that the one-time-perl script was used.
265
! test -e "$HTTPD_ROOT_PATH/one-time-perl" &&
t/t5538-push-shallow.sh
+12
-12
@@ -2,7 +2,7 @@
2
3
test_description='push from/to a shallow clone'
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
@@ -47,9 +47,9 @@ test_expect_success 'push from shallow clone' '
47
(
48
cd shallow &&
49
commit 5 &&
50
- git push ../.git +master:refs/remotes/shallow/master
50
+ git push ../.git +main:refs/remotes/shallow/main
51
) &&
52
- git log --format=%s shallow/master >actual &&
52
+ git log --format=%s shallow/main >actual &&
53
git fsck &&
54
cat <<EOF >expect &&
55
5
@@ -64,10 +64,10 @@ EOF
64
test_expect_success 'push from shallow clone, with grafted roots' '
65
(
66
cd shallow2 &&
67
- test_must_fail git push ../.git +master:refs/remotes/shallow2/master 2>err &&
68
- grep "shallow2/master.*shallow update not allowed" err
67
+ test_must_fail git push ../.git +main:refs/remotes/shallow2/main 2>err &&
68
+ grep "shallow2/main.*shallow update not allowed" err
69
) &&
70
- test_must_fail git rev-parse shallow2/master &&
70
+ test_must_fail git rev-parse shallow2/main &&
71
git fsck
72
'
73
@@ -75,9 +75,9 @@ test_expect_success 'add new shallow root with receive.updateshallow on' '
75
test_config receive.shallowupdate true &&
76
(
77
cd shallow2 &&
78
- git push ../.git +master:refs/remotes/shallow2/master
78
+ git push ../.git +main:refs/remotes/shallow2/main
79
) &&
80
- git log --format=%s shallow2/master >actual &&
80
+ git log --format=%s shallow2/main >actual &&
81
git fsck &&
82
cat <<EOF >expect &&
83
c
@@ -90,12 +90,12 @@ test_expect_success 'push from shallow to shallow' '
90
(
91
cd shallow &&
92
git --git-dir=../shallow2/.git config receive.shallowupdate true &&
93
- git push ../shallow2/.git +master:refs/remotes/shallow/master &&
93
+ git push ../shallow2/.git +main:refs/remotes/shallow/main &&
94
git --git-dir=../shallow2/.git config receive.shallowupdate false
95
) &&
96
(
97
cd shallow2 &&
98
- git log --format=%s shallow/master >actual &&
98
+ git log --format=%s shallow/main >actual &&
99
git fsck &&
100
cat <<EOF >expect &&
101
5
@@ -109,10 +109,10 @@ EOF
109
test_expect_success 'push from full to shallow' '
110
! git --git-dir=shallow2/.git cat-file blob $(echo 1|git hash-object --stdin) &&
111
commit 1 &&
112
- git push shallow2/.git +master:refs/remotes/top/master &&
112
+ git push shallow2/.git +main:refs/remotes/top/main &&
113
(
114
cd shallow2 &&
115
- git log --format=%s top/master >actual &&
115
+ git log --format=%s top/main >actual &&
116
git fsck &&
117
cat <<EOF >expect &&
118
1
t/t5539-fetch-http-shallow.sh
+8
-8
@@ -2,7 +2,7 @@
2
3
test_description='fetch/clone from 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
@@ -35,7 +35,7 @@ test_expect_success 'clone http repository' '
35
(
36
cd clone &&
37
git fsck &&
38
- git log --format=%s origin/master >actual &&
38
+ git log --format=%s origin/main >actual &&
39
cat <<EOF >expect &&
40
7
41
6
@@ -63,9 +63,9 @@ test_expect_success 'no shallow lines after receiving ACK ready' '
63
refs/heads/unrelated$i:refs/heads/unrelated$i ||
64
exit 1
65
done &&
66
- git checkout master &&
66
+ git checkout main &&
67
test_commit new &&
68
- git push "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" master
68
+ git push "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" main
69
) &&
70
(
71
cd clone &&
@@ -98,7 +98,7 @@ test_expect_success 'clone shallow since ...' '
98
99
test_expect_success 'fetch shallow since ...' '
100
git -C shallow11 fetch --shallow-since "200000000 +0700" origin &&
101
- git -C shallow11 log --pretty=tformat:%s origin/master >actual &&
101
+ git -C shallow11 log --pretty=tformat:%s origin/main >actual &&
102
cat >expected <<-\EOF &&
103
three
104
two
@@ -123,7 +123,7 @@ test_expect_success 'shallow clone exclude tag two' '
123
124
test_expect_success 'fetch exclude tag one' '
125
git -C shallow12 fetch --shallow-exclude one origin &&
126
- git -C shallow12 log --pretty=tformat:%s origin/master >actual &&
126
+ git -C shallow12 log --pretty=tformat:%s origin/main >actual &&
127
test_write_lines three two >expected &&
128
test_cmp expected actual
129
'
@@ -139,12 +139,12 @@ test_expect_success 'fetching deepen' '
139
git clone --depth 1 $HTTPD_URL/smart/shallow-deepen.git deepen &&
140
mv "$HTTPD_DOCUMENT_ROOT_PATH/shallow-deepen.git" .git &&
141
test_commit four &&
142
- git -C deepen log --pretty=tformat:%s master >actual &&
142
+ git -C deepen log --pretty=tformat:%s main >actual &&
143
echo three >expected &&
144
test_cmp expected actual &&
145
mv .git "$HTTPD_DOCUMENT_ROOT_PATH/shallow-deepen.git" &&
146
git -C deepen fetch --deepen=1 &&
147
- git -C deepen log --pretty=tformat:%s origin/master >actual &&
147
+ git -C deepen log --pretty=tformat:%s origin/main >actual &&
148
cat >expected <<-\EOF &&
149
four
150
three