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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Nov 18, 2020 at 23:44 UTC 46a29020bb98bf086ef75036abf82ae8721e7466
5 files changed +25 -25
t/t9800-git-p4-basic.sh
+2 -2
@@ -2,7 +2,7 @@
2
3 test_description='git p4 tests'
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 . ./lib-git-p4.sh
@@ -229,7 +229,7 @@ test_expect_success 'clone --bare should make a bare repository' '
229 git config --get --bool core.bare true &&
230 git rev-parse --verify refs/remotes/p4/master &&
231 git rev-parse --verify refs/remotes/p4/HEAD &&
232 - git rev-parse --verify refs/heads/master &&
232 + git rev-parse --verify refs/heads/main &&
233 git rev-parse --verify HEAD
234 )
235 '
t/t9801-git-p4-branch.sh
+9 -9
@@ -2,7 +2,7 @@
2
3 test_description='git p4 tests for p4 branches'
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 . ./lib-git-p4.sh
@@ -70,7 +70,7 @@ test_expect_success 'import main, no branch detection' '
70 (
71 cd "$git" &&
72 git log --oneline --graph --decorate --all &&
73 - git rev-list master -- >wc &&
73 + git rev-list main -- >wc &&
74 test_line_count = 4 wc
75 )
76 '
@@ -81,7 +81,7 @@ test_expect_success 'import branch1, no branch detection' '
81 (
82 cd "$git" &&
83 git log --oneline --graph --decorate --all &&
84 - git rev-list master -- >wc &&
84 + git rev-list main -- >wc &&
85 test_line_count = 2 wc
86 )
87 '
@@ -92,7 +92,7 @@ test_expect_success 'import branch2, no branch detection' '
92 (
93 cd "$git" &&
94 git log --oneline --graph --decorate --all &&
95 - git rev-list master -- >wc &&
95 + git rev-list main -- >wc &&
96 test_line_count = 2 wc
97 )
98 '
@@ -103,7 +103,7 @@ test_expect_success 'import depot, no branch detection' '
103 (
104 cd "$git" &&
105 git log --oneline --graph --decorate --all &&
106 - git rev-list master -- >wc &&
106 + git rev-list main -- >wc &&
107 test_line_count = 8 wc
108 )
109 '
@@ -117,7 +117,7 @@ test_expect_success 'import depot, branch detection' '
117 git log --oneline --graph --decorate --all &&
118
119 # 4 main commits
120 - git rev-list master -- >wc &&
120 + git rev-list main -- >wc &&
121 test_line_count = 4 wc &&
122
123 # 3 main, 1 integrate, 1 on branch2
@@ -140,7 +140,7 @@ test_expect_success 'import depot, branch detection, branchList branch definitio
140 git log --oneline --graph --decorate --all &&
141
142 # 4 main commits
143 - git rev-list master -- >wc &&
143 + git rev-list main -- >wc &&
144 test_line_count = 4 wc &&
145
146 # 3 main, 1 integrate, 1 on branch2
@@ -487,7 +487,7 @@ test_expect_success 'use-client-spec detect-branches files in top-level' '
487 (
488 cd "$git" &&
489 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 &&
491 test_path_is_file b1-file1 &&
492 test_path_is_missing b2-file2 &&
493 test_path_is_missing b1 &&
@@ -540,7 +540,7 @@ test_expect_success 'use-client-spec detect-branches skips files in branches' '
540 (
541 cd "$git" &&
542 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 &&
544 test_path_is_file b1-file1 &&
545 test_path_is_file b3-file3_2 &&
546 test_path_is_missing b3-file3_1
t/t9806-git-p4-options.sh
+10 -10
@@ -2,7 +2,7 @@
2
3 test_description='git p4 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 . ./lib-git-p4.sh
@@ -30,14 +30,14 @@ test_expect_success 'clone no --git-dir' '
30 test_must_fail git p4 clone --git-dir=xx //depot
31 '
32
33 -test_expect_success 'clone --branch should checkout master' '
33 +test_expect_success 'clone --branch should checkout main' '
34 git p4 clone --branch=refs/remotes/p4/sb --dest="$git" //depot &&
35 test_when_finished cleanup_git &&
36 (
37 cd "$git" &&
38 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 &&
41 git rev-parse HEAD >head &&
42 test_cmp sb head
43 )
@@ -150,22 +150,22 @@ test_expect_success 'clone --changesfile, @all' '
150 test_must_fail git p4 clone --changesfile="$TRASH_DIRECTORY/cf" --dest="$git" //depot@all
151 '
152
153 -# imports both master and p4/master in refs/heads
153 +# imports both main and p4/master in refs/heads
154 # 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
156 test_expect_success 'clone/sync --import-local' '
157 git p4 clone --import-local --dest="$git" //depot@1,2 &&
158 test_when_finished cleanup_git &&
159 (
160 cd "$git" &&
161 - git log --oneline refs/heads/master >lines &&
161 + git log --oneline refs/heads/main >lines &&
162 test_line_count = 2 lines &&
163 git log --oneline refs/heads/p4/master >lines &&
164 test_line_count = 2 lines &&
165 test_must_fail git p4 sync &&
166
167 git p4 sync --import-local &&
168 - git log --oneline refs/heads/master >lines &&
168 + git log --oneline refs/heads/main >lines &&
169 test_line_count = 2 lines &&
170 git log --oneline refs/heads/p4/master >lines &&
171 test_line_count = 3 lines
@@ -177,7 +177,7 @@ test_expect_success 'clone --max-changes' '
177 test_when_finished cleanup_git &&
178 (
179 cd "$git" &&
180 - git log --oneline refs/heads/master >lines &&
180 + git log --oneline refs/heads/main >lines &&
181 test_line_count = 2 lines
182 )
183 '
@@ -240,7 +240,7 @@ test_expect_success 'clone --use-client-spec' '
240 git init &&
241 git config git-p4.useClientSpec true &&
242 git p4 sync //depot/... &&
243 - git checkout -b master p4/master &&
243 + git checkout -b main p4/master &&
244 test_path_is_file bus/dir/f4 &&
245 test_path_is_missing file1
246 )
t/t9807-git-p4-submit.sh
+2 -2
@@ -2,7 +2,7 @@
2
3 test_description='git p4 submit'
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 . ./lib-git-p4.sh
@@ -117,7 +117,7 @@ test_expect_success 'submit with allowSubmit' '
117 git config git-p4.skipSubmitEdit true &&
118 git config git-p4.allowSubmit "nobranch" &&
119 test_must_fail git p4 submit &&
120 - git config git-p4.allowSubmit "nobranch,master" &&
120 + git config git-p4.allowSubmit "nobranch,main" &&
121 git p4 submit
122 )
123 '
t/t9811-git-p4-label-import.sh
+2 -2
@@ -2,7 +2,7 @@
2
3 test_description='git p4 label tests'
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 . ./lib-git-p4.sh
@@ -188,7 +188,7 @@ test_expect_success 'tag that cannot be exported' '
188 git add main/f12 &&
189 git commit -m "adding f12" &&
190 git tag -m "tag on a_branch" GIT_TAG_ON_A_BRANCH &&
191 - git checkout master &&
191 + git checkout main &&
192 git p4 submit --export-labels
193 ) &&
194 (