engineering-handbook/hooks/pre-push

19 lines
707 B
Text
Raw Permalink Normal View History

#!/usr/bin/env bash
# pre-push shim for repos that set core.hooksPath.
#
# Setting core.hooksPath in a repo replaces the machine-global hooks directory
# entirely. Without this shim the workstation security pre-push gate is silently
# disabled. This file re-execs the global hook so the gate stays active.
#
# Install: used automatically when a repo's core.hooksPath points to a tracked
# hooks directory containing this file.
GLOBAL="${SH_GLOBAL_HOOKS:-$HOME/.config/git/hooks}/pre-push"
if [ ! -x "$GLOBAL" ]; then
echo "pre-push: global security hook is missing or not executable: $GLOBAL" >&2
echo "Repair the security-review hook installation before pushing." >&2
exit 1
fi
exec "$GLOBAL" "$@"