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

[PATCH 4/8] t1305: use `--git-dir=.` for bare repo in include cycle test

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 24, 2026, 15:01 UTC
Message-ID
<092ec11621ce698e3f3af7bd5024d338440ffce7.1777042877.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2098.git.1777042877.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

Earlier tests in t1305 overwrite `$HOME/.gitconfig` with their own content as part of testing config includes. This clobbers the `safe.bareRepository=all` entry that test-lib.sh writes when `WITH_BREAKING_CHANGES` is in effect, causing `git -C cycle config` to fail with "not in a git directory" when it tries to access the bare repository created by `git init --bare cycle`.

Use `--git-dir=.` to access the bare repo explicitly, avoiding the dependency on global config for repository discovery.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t1305-config-include.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh
index 6e51f892f3..f3892578e4 100755
--- a/t/t1305-config-include.sh
+++ b/t/t1305-config-include.sh
@@ -350,9 +350,9 @@ test_expect_success 'conditional include, onbranch, implicit /** for /' '
 
 test_expect_success 'include cycles are detected' '
 	git init --bare cycle &&
-	git -C cycle config include.path cycle &&
+	git -C cycle --git-dir=. config include.path cycle &&
 	git config -f cycle/cycle include.path config &&
-	test_must_fail git -C cycle config --get-all test.value 2>stderr &&
+	test_must_fail git -C cycle --git-dir=. config --get-all test.value 2>stderr &&
 	grep "exceeded maximum include depth" stderr
 '
 
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Johannes Schindelin via GitGitGadget
Message 9 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.