mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-26 21:47:20 +00:00
3699dca826
.husky/pre-commit and .husky/pre-push are tracked 755 but prepare-commit-msg was 644. In the main checkout that never shows, because git runs husky's generated executable .husky/_ shim, which sources this file regardless of its own mode. Committing from a linked worktree is different. The gitignored .husky/_ does not exist there, so the documented workaround is git -c core.hooksPath=.husky commit, which points git straight at this file. Git then skips it as not executable, prints a one line hint, and commits anyway. That hook is what records PULSE_ALLOW_CONTRACT_NEUTRAL_COMMIT as the Contract-Neutral trailer. Without it a bypassed worktree commit lands with no trailer, passes every local check including Pre-commit checks passed, and is then failed by the canonical governance workflow, which reads the trailer back per commit. The only signal is a red CI run later. Marking the file executable makes the tracked hook run directly under core.hooksPath=.husky. Behaviour in the main checkout is unchanged, since the shim path is unaffected.
18 lines
768 B
Bash
Executable File
18 lines
768 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
set -eu
|
|
|
|
# Record the contract-neutral bypass in the commit itself. The canonical
|
|
# completion guard re-runs per commit on GitHub Actions, where the
|
|
# PULSE_ALLOW_CONTRACT_NEUTRAL_COMMIT env var from the local commit shell
|
|
# does not exist; this trailer is the auditable, machine-readable carrier
|
|
# the canonical-governance workflow reads back for each commit in the
|
|
# pushed range. Without it, every legitimately bypassed commit fails CI.
|
|
msg_file="$1"
|
|
reason="${PULSE_ALLOW_CONTRACT_NEUTRAL_COMMIT:-}"
|
|
reason=$(printf '%s' "$reason" | tr '\n' ' ' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
|
if [ -n "$reason" ]; then
|
|
git interpret-trailers --in-place --if-exists replace \
|
|
--trailer "Contract-Neutral: $reason" "$msg_file"
|
|
fi
|