diff --git a/tests/checks/git.fish b/tests/checks/git.fish index 6cebc2c4f..5ffcc9bad 100644 --- a/tests/checks/git.fish +++ b/tests/checks/git.fish @@ -3,6 +3,15 @@ # e.g. the fish_git_prompt variable handlers test `status is-interactive`. #REQUIRES: command -v git +# 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 +end + +# 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) + # Do some tests with `git` - completions are interesting, # but prompts would also be possible.