fix(husky): re-exec pre-push under bash for sh compatibility

Husky v9 invokes hooks via `sh -e` regardless of the script's shebang,
causing `set -o pipefail` and bash regex `[[ =~ ]]` in .husky/pre-push
to fail with "Illegal option -o pipefail" on systems where /bin/sh is
not bash (Debian/Ubuntu dash).

Add a POSIX-compatible preamble that re-execs the script under bash
when invoked without BASH_VERSION. No changes to gate logic.

Built [OnSteroids](https://onsteroids.ai)
This commit is contained in:
Sergey Galuza
2026-04-20 17:23:27 +02:00
parent 91acec692a
commit dea704c57d
+6
View File
@@ -1,4 +1,10 @@
#!/usr/bin/env bash
# Husky v9 invokes hooks via `sh -e` (see .husky/_/h), ignoring this shebang.
# Re-exec under bash so `set -o pipefail` and `[[ ... ]]` below work portably.
if [ -z "${BASH_VERSION:-}" ]; then
exec bash "$0" "$@"
fi
set -euo pipefail
# Protected branches keep the full CI parity gate.