-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathpre-commit
More file actions
executable file
·31 lines (28 loc) · 1.36 KB
/
Copy pathpre-commit
File metadata and controls
executable file
·31 lines (28 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
# Git pre-commit dispatcher (Option A). core.hooksPath points at .git-hooks/;
# fleet/ and repo/ are peers under it. Runs the fleet hook first, then the
# repo hook if present. Either returning non-zero blocks the commit (escape
# with --no-verify, gated by the `Allow no-verify bypass` phrase). No stdin.
# Fail on the first unhandled non-zero status. Without it a fallible
# command that drops its status turns a refusal into a printed notice the
# shell ignores — how the security step's refusals ran unheeded. Enforced
# by scripts/fleet/check/git-hooks-have-exit-status-propagation.mts.
set -e
# HUSKY=0 skips the whole .git-hooks/ chain for this invocation — the
# husky-compatible escape (`HUSKY=0 git commit …`; export it for a session).
# Heavier than --no-verify: it covers every hook type, including ones git
# gives no flag for (post-commit). Loud and all-or-nothing by design;
# per-step env kill-switches stay banned. For Claude sessions the same
# `Allow no-verify bypass` phrase gates it, along with `--no-verify` and a
# redirected `core.hooksPath` (no-revert-guard).
if [ "${HUSKY-}" = "0" ]; then
echo "[git-hooks] HUSKY=0 — skipping pre-commit."
exit 0
fi
DIR=$(dirname "$0")
if [ -x "$DIR/fleet/pre-commit" ]; then
"$DIR/fleet/pre-commit" "$@" || exit $?
fi
if [ -x "$DIR/repo/pre-commit" ]; then
"$DIR/repo/pre-commit" "$@" || exit $?
fi