mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 18:16:08 +00:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user