#!/usr/bin/env bash
set -euo pipefail

repo_root="$(git rev-parse --show-toplevel)"
cd "$repo_root"

git diff --cached --check

# Ordinary commits stay instant. A pyproject.toml change receives only the
# cheap staged-version policy here; the complete release gate runs pre-push.
if git diff --cached --quiet -- pyproject.toml; then
    exit 0
fi

exec "$repo_root/.githooks/run-release-gate" pre-commit
