Thanatos-27B / scripts /install-hooks.sh
FoolDev's picture
Rename back: Thanatos-27B-Heretic → Thanatos-27B (HF repo also renamed)
7197abd
raw
history blame contribute delete
680 Bytes
#!/usr/bin/env bash
# Thanatos-27B — install scripts/check.sh as a git pre-commit hook.
#
# Idempotent. Re-runs are safe.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
HOOK_DIR="${ROOT}/.git/hooks"
HOOK="${HOOK_DIR}/pre-commit"
if [[ ! -d "${HOOK_DIR}" ]]; then
echo "[!] ${HOOK_DIR} not found. Are you in the repo root?" >&2
exit 1
fi
cat > "${HOOK}" <<'EOF'
#!/usr/bin/env bash
# Auto-installed by scripts/install-hooks.sh.
set -e
ROOT="$(git rev-parse --show-toplevel)"
exec "${ROOT}/scripts/check.sh"
EOF
chmod +x "${HOOK}"
echo "[+] installed pre-commit hook -> ${HOOK}"
echo " (it will run scripts/check.sh on every git commit)"