From ee93d78b55ada32aa74b5e9957aac9c2523dd22c Mon Sep 17 00:00:00 2001
From: Peter Evans <18365890+peter-evans@users.noreply.github.com>
Date: Fri, 11 Nov 2022 16:15:15 +0900
Subject: [PATCH] test: set default branch to main (#1310)

---
 __test__/create-or-update-branch.int.test.ts | 8 ++++----
 __test__/entrypoint.sh                       | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/__test__/create-or-update-branch.int.test.ts b/__test__/create-or-update-branch.int.test.ts
index 213dc83..5e0db0b 100644
--- a/__test__/create-or-update-branch.int.test.ts
+++ b/__test__/create-or-update-branch.int.test.ts
@@ -14,7 +14,7 @@ const REMOTE_NAME = 'origin'
 const TRACKED_FILE = 'a/tracked-file.txt'
 const UNTRACKED_FILE = 'b/untracked-file.txt'
 
-const DEFAULT_BRANCH = 'tests/master'
+const DEFAULT_BRANCH = 'tests/main'
 const NOT_BASE_BRANCH = 'tests/branch-that-is-not-the-base'
 const NOT_EXIST_BRANCH = 'tests/branch-that-does-not-exist'
 
@@ -108,10 +108,10 @@ describe('create-or-update-branch tests', () => {
     // Check there are no local changes that might be destroyed by running these tests
     expect(await git.isDirty(true)).toBeFalsy()
     // Fetch the default branch
-    await git.fetch(['master:refs/remotes/origin/master'])
+    await git.fetch(['main:refs/remotes/origin/main'])
 
     // Create a "not base branch" for the test run
-    await git.checkout('master')
+    await git.checkout('main')
     await git.checkout(NOT_BASE_BRANCH, 'HEAD')
     await createFile(TRACKED_FILE)
     await git.exec(['add', '-A'])
@@ -123,7 +123,7 @@ describe('create-or-update-branch tests', () => {
     ])
 
     // Create a new default branch for the test run with a tracked file
-    await git.checkout('master')
+    await git.checkout('main')
     await git.checkout(DEFAULT_BRANCH, 'HEAD')
     await createFile(TRACKED_FILE)
     await git.exec(['add', '-A'])
diff --git a/__test__/entrypoint.sh b/__test__/entrypoint.sh
index dd13fe9..7dc7ccd 100755
--- a/__test__/entrypoint.sh
+++ b/__test__/entrypoint.sh
@@ -6,6 +6,7 @@ WORKINGDIR=$PWD
 
 # Create and serve a remote repo
 mkdir -p /git/remote
+git config --global init.defaultBranch main
 git init --bare /git/remote/test-base.git
 git daemon --verbose --enable=receive-pack --base-path=/git/remote --export-all /git/remote &>/dev/null &