t5601: restore `.gitconfig` after includeIf test
One test in t5601 overwrites `$HOME/.gitconfig` with an `includeIf` configuration snippet and removes the file in its cleanup. This destroys the `safe.bareRepository=all` entry that test-lib.sh writes when `WITH_BREAKING_CHANGES` is in effect, causing later tests that use `git -C <bare-repo> config` to fail with "not in a git directory". Back up `.gitconfig` before overwriting and restore it in the cleanup, so the global config survives into subsequent tests. Assisted-by: Claude Opus 4.6 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Apr 26, 2026 at 14:38 UTC
d97f27bf01a1ba2cfa66cc8e55f03e701084240e
1 file changed
+3
-1
t/t5601-clone.sh
+3
-1
@@ -813,7 +813,9 @@ test_expect_success 'clone with includeIf' '
813
test_when_finished "rm -rf repo \"$HTTPD_DOCUMENT_ROOT_PATH/repo.git\"" &&
814
git clone --bare --no-local src "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
815
816
- test_when_finished "rm \"$HOME\"/.gitconfig" &&
816
+ test_when_finished "cp \"$HOME\"/.gitconfig.bak \
817
+ \"$HOME\"/.gitconfig 2>/dev/null || rm -f \"$HOME\"/.gitconfig" &&
818
+ cp "$HOME"/.gitconfig "$HOME"/.gitconfig.bak 2>/dev/null &&
819
cat >"$HOME"/.gitconfig <<-EOF &&
820
[includeIf "onbranch:something"]
821
path = /does/not/exist.inc