]> git.scottworley.com Git - git-cache/commitdiff
Fix nested-git issues in pre-commit hook
authorScott Worley <scottworley@scottworley.com>
Mon, 3 Jun 2024 09:30:45 +0000 (02:30 -0700)
committerScott Worley <scottworley@scottworley.com>
Mon, 3 Jun 2024 09:32:36 +0000 (02:32 -0700)
Changelog
git-pre-commit-hook

index eeaebfb7eddcfb4d0308f3537086c4d0eafcab3e..898c79db3e0d37ba2f9c5e104dac2b944d69a6b5 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,5 +1,6 @@
 ## [Unreleased]
 - Use a specific Exception type
 ## [Unreleased]
 - Use a specific Exception type
+- Fix git-precommit-hook environment (git commit -a works now)
 
 
 ## [1.4.3] - 2023-05-24
 
 
 ## [1.4.3] - 2023-05-24
index 85b444576abb508a61b0e5d3ab7bd88397610c35..ce476144f4f5a6d9c2e7ed8a018b7b14b7692f73 100755 (executable)
@@ -17,6 +17,16 @@ D=$(mktemp -d)
 git checkout-index --prefix="$D/" -a
 pushd "$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
 nix-shell --arg lint true --run './test.sh lint'
 
 popd