Skip to content

Commit 058ad4e

Browse files
committed
fix: Use POSIX redirect in pre-commit gitleaks guard
`&> /dev/null` is a bashism. Husky runs hooks under `/bin/sh`, so on systems where that is dash the guard parsed as a backgrounded `command -v gitleaks &` followed by a bare `> /dev/null` redirection, whose exit status is always 0. That made the `if` always true, so `gitleaks protect` ran even when gitleaks was not installed and the warning branch was unreachable. This was failing on CI with Linux runners.
1 parent 95f0fa6 commit 058ad4e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎.husky/pre-commit‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Check for secrets in staged files before committing
2-
if command -v gitleaks &> /dev/null; then
2+
if command -v gitleaks >/dev/null 2>&1; then
33
gitleaks protect --staged --redact --no-banner
44
else
55
echo "WARNING: gitleaks not installed — skipping secret scan. Install via: brew install gitleaks"

0 commit comments

Comments
 (0)