From e3d8b315edfdde379688c07ee478158e227720c4 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Mon, 12 Jul 2021 21:37:17 +0200 Subject: [PATCH] Avoid global and user git config leaking into git tests --- tests/checks/git.fish | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/checks/git.fish b/tests/checks/git.fish index 43b6d8b78..f0158177c 100644 --- a/tests/checks/git.fish +++ b/tests/checks/git.fish @@ -6,9 +6,12 @@ # Tests run from git (e.g. git rebase --exec 'ninja test'...) inherit a weird git environment. # Ensure that no git environment variables are inherited. for varname in (set -x | string match 'GIT_*' | string replace -r ' .*' '') - set -e $varname + set -e $varname end +set -gx GIT_CONFIG_GLOBAL /dev/null # No ~/.gitconfig. We could also override $HOME. +set -gx GIT_CONFIG_NOSYSTEM true # No /etc/gitconfig + # Also ensure that git-core is not in $PATH, as this adds weird git commands like `git-add--interactive`. set PATH (string match --invert '*git-core*' -- $PATH)