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

[PATCH v2 3/8] t1300: remove global config settings injected by test-lib.sh

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 26, 2026, 14:38 UTC
Message-ID
<7d68155805f9681f4071ad6d4378960ce36e667b.1777214316.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2098.v2.git.1777214316.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

Since test-lib.sh now writes `safe.bareRepository=all` to the global config when `WITH_BREAKING_CHANGES` is in effect, that entry shows up in `git config --list` output. Tests in t1300 that expect exact config contents then fail because of this unexpected extra line.

Unlike the working-tree contamination fixed in the preceding commits, this is not about the file's existence but about its content leaking into test expectations. Since t1300 does not use bare repositories, simply remove the injected setting in a preparatory step.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Assisted-by: Claude Opus 4.6
---
 t/t1300-config.sh | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index 128971ee12..11fc976f3a 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -11,6 +11,13 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-terminal.sh
 
+# test-lib.sh may have added global config (e.g. safe.bareRepository)
+# that would appear in "git config --list" output and break tests
+# that expect exact config contents.
+test_expect_success 'remove global config from test-lib.sh' '
+	test_might_fail git config --global --unset-all safe.bareRepository
+'
+
 for mode in legacy subcommands
 do
 
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Johannes Schindelin via GitGitGadget
Message 14 of 19 in “safe.bareRepository: default to "explicit" with WITH_BREAKING_CHANGES”
  1. 0/8 safe.bareRepository: default to "explicit" with WITH_BREAKING_CHANGESJohannes Schindelin via GitGitGadget, Apr 24, 2026
  2. 1/8 test-lib: allow bare repository access when breaking changes are enabledJohannes Schindelin via GitGitGadget, Apr 24, 2026
  3. 2/8 t7900: do not let `$HOME/.gitconfig` interfere with XDG testsJohannes Schindelin via GitGitGadget, Apr 24, 2026
  4. 3/8 t1300: remove global config settings injected by test-lib.shJohannes Schindelin via GitGitGadget, Apr 24, 2026
  5. 6/8 ls-files tests: filter `.gitconfig` from `--others` outputJohannes Schindelin via GitGitGadget, Apr 24, 2026
  6. Junio C HamanoApr 26, 2026
  7. 7/8 status tests: filter `.gitconfig` from status outputJohannes Schindelin via GitGitGadget, Apr 24, 2026
  8. 8/8 safe.bareRepository: default to "explicit" with WITH_BREAKING_CHANGESJohannes Schindelin via GitGitGadget, Apr 24, 2026
  9. 4/8 t1305: use `--git-dir=.` for bare repo in include cycle testJohannes Schindelin via GitGitGadget, Apr 24, 2026
  10. 5/8 t5601: restore `.gitconfig` after includeIf testJohannes Schindelin via GitGitGadget, Apr 24, 2026
  11. 0/8 safe.bareRepository: default to "explicit" with WITH_BREAKING_CHANGESJohannes Schindelin via GitGitGadget, Apr 26, 2026
  12. 1/8 test-lib: allow bare repository access when breaking changes are enabledJohannes Schindelin via GitGitGadget, Apr 26, 2026
  13. 2/8 t7900: do not let `$HOME/.gitconfig` interfere with XDG testsJohannes Schindelin via GitGitGadget, Apr 26, 2026
  14. 3/8 t1300: remove global config settings injected by test-lib.shJohannes Schindelin via GitGitGadget, Apr 26, 2026
  15. 4/8 t1305: use `--git-dir=.` for bare repo in include cycle testJohannes Schindelin via GitGitGadget, Apr 26, 2026
  16. 5/8 t5601: restore `.gitconfig` after includeIf testJohannes Schindelin via GitGitGadget, Apr 26, 2026
  17. 6/8 ls-files tests: filter `.gitconfig` from `--others` outputJohannes Schindelin via GitGitGadget, Apr 26, 2026
  18. 7/8 status tests: filter `.gitconfig` from status outputJohannes Schindelin via GitGitGadget, Apr 26, 2026
  19. 8/8 safe.bareRepository: default to "explicit" with WITH_BREAKING_CHANGESJohannes Schindelin via GitGitGadget, Apr 26, 2026

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.