From d3b8a09dab31bd579466407aa9153219016eb45b Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Mon, 3 Jun 2024 02:30:45 -0700 Subject: [PATCH 1/1] Fix nested-git issues in pre-commit hook --- Changelog | 1 + git-pre-commit-hook | 10 ++++++++++ 2 files changed, 11 insertions(+) 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 -- 2.44.1