-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathcommit-msg
More file actions
executable file
·27 lines (24 loc) · 1.08 KB
/
Copy pathcommit-msg
File metadata and controls
executable file
·27 lines (24 loc) · 1.08 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
#!/bin/sh
# Git commit-msg 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. $1 is the
# path to the commit-message file. The fleet/repo entry points source their
# own _shared/resolve-node.sh, so this dispatcher stays pure POSIX sh.
# 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 this hook for the current invocation — the husky-compatible
# whole-chain escape (details in the pre-commit dispatcher).
if [ "${HUSKY-}" = "0" ]; then
echo "[git-hooks] HUSKY=0 — skipping commit-msg."
exit 0
fi
DIR=$(dirname "$0")
if [ -x "$DIR/fleet/commit-msg" ]; then
"$DIR/fleet/commit-msg" "$@" || exit $?
fi
if [ -x "$DIR/repo/commit-msg" ]; then
"$DIR/repo/commit-msg" "$@" || exit $?
fi