]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t1305: use `--git-dir=.` for bare repo in include cycle test
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sun, 26 Apr 2026 14:38:32 +0000 (14:38 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Apr 2026 05:50:53 +0000 (14:50 +0900)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1305-config-include.sh

index 6e51f892f320bb5c3ec51732cc517ce87bb2b49e..f3892578e4ff866fe78250038fd99525c24861d4 100755 (executable)
@@ -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
 '