From: Scott Worley Date: Mon, 3 Jun 2024 09:30:45 +0000 (-0700) Subject: Fix nested-git issues in pre-commit hook X-Git-Tag: v1.4.4~1 X-Git-Url: http://git.scottworley.com/git-cache/commitdiff_plain/d3b8a09dab31bd579466407aa9153219016eb45b Fix nested-git issues in pre-commit hook --- diff --git a/Changelog b/Changelog index eeaebfb..898c79d 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,6 @@ ## [Unreleased] - Use a specific Exception type +- Fix git-precommit-hook environment (git commit -a works now) ## [1.4.3] - 2023-05-24 diff --git a/git-pre-commit-hook b/git-pre-commit-hook index 85b4445..ce47614 100755 --- a/git-pre-commit-hook +++ b/git-pre-commit-hook @@ -17,6 +17,16 @@ D=$(mktemp -d) git checkout-index --prefix="$D/" -a pushd "$D" +# So we don't confuse the inner git invocations inside the tests with +# the outer git invocation that's trying to commit a change. +unset GIT_AUTHOR_DATE +unset GIT_AUTHOR_EMAIL +unset GIT_AUTHOR_NAME +unset GIT_CONFIG_PARAMETERS +unset GIT_EXEC_PATH +unset GIT_INDEX_FILE +unset GIT_PREFIX + nix-shell --arg lint true --run './test.sh lint' popd