diff options
Diffstat (limited to 'githooks/pre-commit')
| -rwxr-xr-x | githooks/pre-commit | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/githooks/pre-commit b/githooks/pre-commit new file mode 100755 index 0000000..ece0c8a --- /dev/null +++ b/githooks/pre-commit @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# +# pre-commit hook — block commits when the canonical/mirror pair drifts. +# +# Enable by running: git config core.hooksPath githooks +# (handled by make install-hooks; idempotent on re-run.) + +set -euo pipefail + +repo_root="$(git rev-parse --show-toplevel)" +"$repo_root/scripts/sync-check.sh" || { + echo "" >&2 + echo "pre-commit: canonical/mirror drift detected. Commit blocked." >&2 + exit 1 +} |
