Skip to contentSkip to conversation

t7817: do not depend on any specific default branch name

PATCH New Johannes Schindelin via GitGitGadget 1 participant 1 message Dec 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t7817: do not depend on any specific default branch name

From: Johannes Schindelin <[email protected]>

Elsewhere, we introduced support to override the default branch name in the tests via GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME. Therefore, we should avoid expecting a particular hard-coded name in test scripts.

So let's rename the initial branch immediately to main and work with that.

This avoids breakages in t7817 when the default branch name is changed.

---
t7817: do not depend on any specific default branch name

This should fix the CI build of seen with regard to t7817. The patch is designed to be applied on top of mt/grep-sparse-checkout.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-808%2Fdscho%2Ft7817-and-the-default-branch-name-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-808/dscho/t7817-and-the-default-branch-name-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/808

 t/t7817-grep-sparse-checkout.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
t/t7817-grep-sparse-checkout.sh +5 -4
index f93a4f71d1..d9d32c6435 100755
@@ -77,7 +77,8 @@ test_expect_success 'setup' '
 	test_path_is_missing sub/A &&
 	test_path_is_file a &&
 	test_path_is_file sub/B/b &&
-	test_path_is_file sub2/a
+	test_path_is_file sub2/a &&
+	git branch -m main
 '
 
 # The two tests below check a special case: the sparsity patterns exclude '/b'
@@ -110,12 +111,12 @@ test_expect_success 'grep unmerged file despite not matching sparsity patterns'
 	b:modified-b-in-branchY
 	EOF
 	test_when_finished "test_might_fail git merge --abort && \
-			    git checkout master" &&
+			    git checkout main" &&
 
 	git sparse-checkout disable &&
-	git checkout -b branchY master &&
+	git checkout -b branchY main &&
 	test_commit modified-b-in-branchY b &&
-	git checkout -b branchX master &&
+	git checkout -b branchX main &&
 	test_commit modified-b-in-branchX b &&
 
 	git sparse-checkout init &&

base-commit: aaff72b8c3e3d95917f3432396073a7708b16a90

Signature · 1 line
gitgitgadget