]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests(git-p4): transition to the default branch name `main`
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 18 Nov 2020 23:44:44 +0000 (23:44 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 19 Nov 2020 23:44:18 +0000 (15:44 -0800)
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>
t/t9800-git-p4-basic.sh
t/t9801-git-p4-branch.sh
t/t9806-git-p4-options.sh
t/t9807-git-p4-submit.sh
t/t9811-git-p4-label-import.sh

index c920b8477878aa38926c7590c7c212c5107646a4..81bc8e8da1aa3feeec001b9f479998d76e899dd8 100755 (executable)
@@ -2,7 +2,7 @@
 
 test_description='git p4 tests'
 
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./lib-git-p4.sh
@@ -229,7 +229,7 @@ test_expect_success 'clone --bare should make a bare repository' '
                git config --get --bool core.bare true &&
                git rev-parse --verify refs/remotes/p4/master &&
                git rev-parse --verify refs/remotes/p4/HEAD &&
-               git rev-parse --verify refs/heads/master &&
+               git rev-parse --verify refs/heads/main &&
                git rev-parse --verify HEAD
        )
 '
index ebfe9d819513a4ff9bb5fbb0887f90b513757a81..56e64697a804932b1e1dcdfaa9a95239f4fd6fa9 100755 (executable)
@@ -2,7 +2,7 @@
 
 test_description='git p4 tests for p4 branches'
 
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./lib-git-p4.sh
@@ -70,7 +70,7 @@ test_expect_success 'import main, no branch detection' '
        (
                cd "$git" &&
                git log --oneline --graph --decorate --all &&
-               git rev-list master -- >wc &&
+               git rev-list main -- >wc &&
                test_line_count = 4 wc
        )
 '
@@ -81,7 +81,7 @@ test_expect_success 'import branch1, no branch detection' '
        (
                cd "$git" &&
                git log --oneline --graph --decorate --all &&
-               git rev-list master -- >wc &&
+               git rev-list main -- >wc &&
                test_line_count = 2 wc
        )
 '
@@ -92,7 +92,7 @@ test_expect_success 'import branch2, no branch detection' '
        (
                cd "$git" &&
                git log --oneline --graph --decorate --all &&
-               git rev-list master -- >wc &&
+               git rev-list main -- >wc &&
                test_line_count = 2 wc
        )
 '
@@ -103,7 +103,7 @@ test_expect_success 'import depot, no branch detection' '
        (
                cd "$git" &&
                git log --oneline --graph --decorate --all &&
-               git rev-list master -- >wc &&
+               git rev-list main -- >wc &&
                test_line_count = 8 wc
        )
 '
@@ -117,7 +117,7 @@ test_expect_success 'import depot, branch detection' '
                git log --oneline --graph --decorate --all &&
 
                # 4 main commits
-               git rev-list master -- >wc &&
+               git rev-list main -- >wc &&
                test_line_count = 4 wc &&
 
                # 3 main, 1 integrate, 1 on branch2
@@ -140,7 +140,7 @@ test_expect_success 'import depot, branch detection, branchList branch definitio
                git log --oneline --graph --decorate --all &&
 
                # 4 main commits
-               git rev-list master -- >wc &&
+               git rev-list main -- >wc &&
                test_line_count = 4 wc &&
 
                # 3 main, 1 integrate, 1 on branch2
@@ -487,7 +487,7 @@ test_expect_success 'use-client-spec detect-branches files in top-level' '
        (
                cd "$git" &&
                git p4 sync --detect-branches --use-client-spec //depot/usecs@all &&
-               git checkout -b master p4/usecs/b1 &&
+               git checkout -b main p4/usecs/b1 &&
                test_path_is_file b1-file1 &&
                test_path_is_missing b2-file2 &&
                test_path_is_missing b1 &&
@@ -540,7 +540,7 @@ test_expect_success 'use-client-spec detect-branches skips files in branches' '
        (
                cd "$git" &&
                git p4 sync --detect-branches --use-client-spec //depot/usecs@all &&
-               git checkout -b master p4/usecs/b3 &&
+               git checkout -b main p4/usecs/b3 &&
                test_path_is_file b1-file1 &&
                test_path_is_file b3-file3_2 &&
                test_path_is_missing b3-file3_1
index c7629b6c7d7b33041ecfdae6aa31b5c3913742d5..c26d29743307b5546d80e9c6d0cd16442a43a421 100755 (executable)
@@ -2,7 +2,7 @@
 
 test_description='git p4 options'
 
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./lib-git-p4.sh
@@ -30,14 +30,14 @@ test_expect_success 'clone no --git-dir' '
        test_must_fail git p4 clone --git-dir=xx //depot
 '
 
-test_expect_success 'clone --branch should checkout master' '
+test_expect_success 'clone --branch should checkout main' '
        git p4 clone --branch=refs/remotes/p4/sb --dest="$git" //depot &&
        test_when_finished cleanup_git &&
        (
                cd "$git" &&
                git rev-parse refs/remotes/p4/sb >sb &&
-               git rev-parse refs/heads/master >master &&
-               test_cmp sb master &&
+               git rev-parse refs/heads/main >main &&
+               test_cmp sb main &&
                git rev-parse HEAD >head &&
                test_cmp sb head
        )
@@ -150,22 +150,22 @@ test_expect_success 'clone --changesfile, @all' '
        test_must_fail git p4 clone --changesfile="$TRASH_DIRECTORY/cf" --dest="$git" //depot@all
 '
 
-# imports both master and p4/master in refs/heads
+# imports both main and p4/master in refs/heads
 # requires --import-local on sync to find p4 refs/heads
-# does not update master on sync, just p4/master
+# does not update main on sync, just p4/master
 test_expect_success 'clone/sync --import-local' '
        git p4 clone --import-local --dest="$git" //depot@1,2 &&
        test_when_finished cleanup_git &&
        (
                cd "$git" &&
-               git log --oneline refs/heads/master >lines &&
+               git log --oneline refs/heads/main >lines &&
                test_line_count = 2 lines &&
                git log --oneline refs/heads/p4/master >lines &&
                test_line_count = 2 lines &&
                test_must_fail git p4 sync &&
 
                git p4 sync --import-local &&
-               git log --oneline refs/heads/master >lines &&
+               git log --oneline refs/heads/main >lines &&
                test_line_count = 2 lines &&
                git log --oneline refs/heads/p4/master >lines &&
                test_line_count = 3 lines
@@ -177,7 +177,7 @@ test_expect_success 'clone --max-changes' '
        test_when_finished cleanup_git &&
        (
                cd "$git" &&
-               git log --oneline refs/heads/master >lines &&
+               git log --oneline refs/heads/main >lines &&
                test_line_count = 2 lines
        )
 '
@@ -240,7 +240,7 @@ test_expect_success 'clone --use-client-spec' '
                        git init &&
                        git config git-p4.useClientSpec true &&
                        git p4 sync //depot/... &&
-                       git checkout -b master p4/master &&
+                       git checkout -b main p4/master &&
                        test_path_is_file bus/dir/f4 &&
                        test_path_is_missing file1
                )
index f12e6f72068fc7617feb07d9cecca45759e6d194..7d4109f29d5e3b5751a9fba8b15c5a6d5d3e0fa6 100755 (executable)
@@ -2,7 +2,7 @@
 
 test_description='git p4 submit'
 
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./lib-git-p4.sh
@@ -117,7 +117,7 @@ test_expect_success 'submit with allowSubmit' '
                git config git-p4.skipSubmitEdit true &&
                git config git-p4.allowSubmit "nobranch" &&
                test_must_fail git p4 submit &&
-               git config git-p4.allowSubmit "nobranch,master" &&
+               git config git-p4.allowSubmit "nobranch,main" &&
                git p4 submit
        )
 '
index c53952ac14303ed68bdee508823cef85fe3d7c8f..5ac5383fb717153b893302eba7952b6962de70a2 100755 (executable)
@@ -2,7 +2,7 @@
 
 test_description='git p4 label tests'
 
-GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./lib-git-p4.sh
@@ -188,7 +188,7 @@ test_expect_success 'tag that cannot be exported' '
                git add main/f12 &&
                git commit -m "adding f12" &&
                git tag -m "tag on a_branch" GIT_TAG_ON_A_BRANCH &&
-               git checkout master &&
+               git checkout main &&
                git p4 submit --export-labels
        ) &&
        (