git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t7817: do not depend on any specific default branch name

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Dec 4, 2020, 21:06 UTC
Message-ID
<pull.808.git.1607115981367.gitgitgadget@gmail.com>
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(-)
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 &&

base-commit: aaff72b8c3e3d95917f3432396073a7708b16a90
-- 
gitgitgadget
Message 1 of 1 in “t7817: do not depend on any specific default branch name”
  1. t7817: do not depend on any specific default branch nameJohannes Schindelin via GitGitGadget, Dec 4, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.