diff mbox series

t7817: do not depend on any specific default branch name

Message ID pull.808.git.1607115981367.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series t7817: do not depend on any specific default branch name | expand

Commit Message

Johannes Schindelin Dec. 4, 2020, 9:06 p.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

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.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    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(-)


base-commit: aaff72b8c3e3d95917f3432396073a7708b16a90
diff mbox series

Patch

diff --git a/t/t7817-grep-sparse-checkout.sh b/t/t7817-grep-sparse-checkout.sh
index f93a4f71d1..d9d32c6435 100755
--- a/t/t7817-grep-sparse-checkout.sh
+++ b/t/t7817-grep-sparse-checkout.sh
@@ -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 &&