Skip to content

Commit 46a2902

Browse files
dschogitster
authored andcommitted
tests(git-p4): transition to the default branch name main
In the previous commits, we adjusted the test suite to use the branch name `main` for initial branches. The `git p4`-related tests are a bit harder to adjust because `git p4` uses the ref `refs/heads/p4/master` to track the remote branches, and for now, we do not want to change that (this might be the subject of a future patch series). We only need to adjust for the actual initial branch name to be changed to `main`. This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main` for those tests. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 765577b commit 46a2902

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

t/t9800-git-p4-basic.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
test_description='git p4 tests'
44

5-
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
66
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77

88
. ./lib-git-p4.sh
@@ -229,7 +229,7 @@ test_expect_success 'clone --bare should make a bare repository' '
229229
git config --get --bool core.bare true &&
230230
git rev-parse --verify refs/remotes/p4/master &&
231231
git rev-parse --verify refs/remotes/p4/HEAD &&
232-
git rev-parse --verify refs/heads/master &&
232+
git rev-parse --verify refs/heads/main &&
233233
git rev-parse --verify HEAD
234234
)
235235
'

t/t9801-git-p4-branch.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
test_description='git p4 tests for p4 branches'
44

5-
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
66
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77

88
. ./lib-git-p4.sh
@@ -70,7 +70,7 @@ test_expect_success 'import main, no branch detection' '
7070
(
7171
cd "$git" &&
7272
git log --oneline --graph --decorate --all &&
73-
git rev-list master -- >wc &&
73+
git rev-list main -- >wc &&
7474
test_line_count = 4 wc
7575
)
7676
'
@@ -81,7 +81,7 @@ test_expect_success 'import branch1, no branch detection' '
8181
(
8282
cd "$git" &&
8383
git log --oneline --graph --decorate --all &&
84-
git rev-list master -- >wc &&
84+
git rev-list main -- >wc &&
8585
test_line_count = 2 wc
8686
)
8787
'
@@ -92,7 +92,7 @@ test_expect_success 'import branch2, no branch detection' '
9292
(
9393
cd "$git" &&
9494
git log --oneline --graph --decorate --all &&
95-
git rev-list master -- >wc &&
95+
git rev-list main -- >wc &&
9696
test_line_count = 2 wc
9797
)
9898
'
@@ -103,7 +103,7 @@ test_expect_success 'import depot, no branch detection' '
103103
(
104104
cd "$git" &&
105105
git log --oneline --graph --decorate --all &&
106-
git rev-list master -- >wc &&
106+
git rev-list main -- >wc &&
107107
test_line_count = 8 wc
108108
)
109109
'
@@ -117,7 +117,7 @@ test_expect_success 'import depot, branch detection' '
117117
git log --oneline --graph --decorate --all &&
118118
119119
# 4 main commits
120-
git rev-list master -- >wc &&
120+
git rev-list main -- >wc &&
121121
test_line_count = 4 wc &&
122122
123123
# 3 main, 1 integrate, 1 on branch2
@@ -140,7 +140,7 @@ test_expect_success 'import depot, branch detection, branchList branch definitio
140140
git log --oneline --graph --decorate --all &&
141141
142142
# 4 main commits
143-
git rev-list master -- >wc &&
143+
git rev-list main -- >wc &&
144144
test_line_count = 4 wc &&
145145
146146
# 3 main, 1 integrate, 1 on branch2
@@ -487,7 +487,7 @@ test_expect_success 'use-client-spec detect-branches files in top-level' '
487487
(
488488
cd "$git" &&
489489
git p4 sync --detect-branches --use-client-spec //depot/usecs@all &&
490-
git checkout -b master p4/usecs/b1 &&
490+
git checkout -b main p4/usecs/b1 &&
491491
test_path_is_file b1-file1 &&
492492
test_path_is_missing b2-file2 &&
493493
test_path_is_missing b1 &&
@@ -540,7 +540,7 @@ test_expect_success 'use-client-spec detect-branches skips files in branches' '
540540
(
541541
cd "$git" &&
542542
git p4 sync --detect-branches --use-client-spec //depot/usecs@all &&
543-
git checkout -b master p4/usecs/b3 &&
543+
git checkout -b main p4/usecs/b3 &&
544544
test_path_is_file b1-file1 &&
545545
test_path_is_file b3-file3_2 &&
546546
test_path_is_missing b3-file3_1

t/t9806-git-p4-options.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
test_description='git p4 options'
44

5-
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
66
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77

88
. ./lib-git-p4.sh
@@ -30,14 +30,14 @@ test_expect_success 'clone no --git-dir' '
3030
test_must_fail git p4 clone --git-dir=xx //depot
3131
'
3232

33-
test_expect_success 'clone --branch should checkout master' '
33+
test_expect_success 'clone --branch should checkout main' '
3434
git p4 clone --branch=refs/remotes/p4/sb --dest="$git" //depot &&
3535
test_when_finished cleanup_git &&
3636
(
3737
cd "$git" &&
3838
git rev-parse refs/remotes/p4/sb >sb &&
39-
git rev-parse refs/heads/master >master &&
40-
test_cmp sb master &&
39+
git rev-parse refs/heads/main >main &&
40+
test_cmp sb main &&
4141
git rev-parse HEAD >head &&
4242
test_cmp sb head
4343
)
@@ -150,22 +150,22 @@ test_expect_success 'clone --changesfile, @all' '
150150
test_must_fail git p4 clone --changesfile="$TRASH_DIRECTORY/cf" --dest="$git" //depot@all
151151
'
152152

153-
# imports both master and p4/master in refs/heads
153+
# imports both main and p4/master in refs/heads
154154
# requires --import-local on sync to find p4 refs/heads
155-
# does not update master on sync, just p4/master
155+
# does not update main on sync, just p4/master
156156
test_expect_success 'clone/sync --import-local' '
157157
git p4 clone --import-local --dest="$git" //depot@1,2 &&
158158
test_when_finished cleanup_git &&
159159
(
160160
cd "$git" &&
161-
git log --oneline refs/heads/master >lines &&
161+
git log --oneline refs/heads/main >lines &&
162162
test_line_count = 2 lines &&
163163
git log --oneline refs/heads/p4/master >lines &&
164164
test_line_count = 2 lines &&
165165
test_must_fail git p4 sync &&
166166
167167
git p4 sync --import-local &&
168-
git log --oneline refs/heads/master >lines &&
168+
git log --oneline refs/heads/main >lines &&
169169
test_line_count = 2 lines &&
170170
git log --oneline refs/heads/p4/master >lines &&
171171
test_line_count = 3 lines
@@ -177,7 +177,7 @@ test_expect_success 'clone --max-changes' '
177177
test_when_finished cleanup_git &&
178178
(
179179
cd "$git" &&
180-
git log --oneline refs/heads/master >lines &&
180+
git log --oneline refs/heads/main >lines &&
181181
test_line_count = 2 lines
182182
)
183183
'
@@ -240,7 +240,7 @@ test_expect_success 'clone --use-client-spec' '
240240
git init &&
241241
git config git-p4.useClientSpec true &&
242242
git p4 sync //depot/... &&
243-
git checkout -b master p4/master &&
243+
git checkout -b main p4/master &&
244244
test_path_is_file bus/dir/f4 &&
245245
test_path_is_missing file1
246246
)

t/t9807-git-p4-submit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
test_description='git p4 submit'
44

5-
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
66
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77

88
. ./lib-git-p4.sh
@@ -117,7 +117,7 @@ test_expect_success 'submit with allowSubmit' '
117117
git config git-p4.skipSubmitEdit true &&
118118
git config git-p4.allowSubmit "nobranch" &&
119119
test_must_fail git p4 submit &&
120-
git config git-p4.allowSubmit "nobranch,master" &&
120+
git config git-p4.allowSubmit "nobranch,main" &&
121121
git p4 submit
122122
)
123123
'

t/t9811-git-p4-label-import.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
test_description='git p4 label tests'
44

5-
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
66
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77

88
. ./lib-git-p4.sh
@@ -188,7 +188,7 @@ test_expect_success 'tag that cannot be exported' '
188188
git add main/f12 &&
189189
git commit -m "adding f12" &&
190190
git tag -m "tag on a_branch" GIT_TAG_ON_A_BRANCH &&
191-
git checkout master &&
191+
git checkout main &&
192192
git p4 submit --export-labels
193193
) &&
194194
(

0 commit comments

Comments
 (0)