Skip to content

Commit 181c03d

Browse files
authored
Merge pull request #1741 from bmcnaboe/codex/fix-precommit-git-environment
fix(hooks): clear repository git environment for tests
2 parents 95c91b8 + c0bfd07 commit 181c03d

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎scripts/hooks/pre-commit‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,13 @@ echo "pre-commit: security audit (source-level)..."
1717
scripts/security-audit.sh
1818

1919
echo "pre-commit: building and running tests..."
20-
make -j$(sysctl -n hw.ncpu 2>/dev/null || nproc) -f Makefile.cbm test
20+
(
21+
# Git exports repository-local variables to hooks. The test suite creates
22+
# independent repositories and linked worktrees, so keep the commit's
23+
# index and object paths out of those fixtures.
24+
while IFS= read -r variable; do
25+
unset "$variable"
26+
done < <(git rev-parse --local-env-vars)
27+
28+
make -j"$(sysctl -n hw.ncpu 2>/dev/null || nproc)" -f Makefile.cbm test
29+
)

0 commit comments

Comments
 (0)