#!/usr/bin/env bash
# Pre-push hook: runs the full CI-mirror suite before allowing a push.
# Prevents broken builds from reaching Gitea.
#
# Auto-activated by `make install` via git core.hooksPath.

set -e

echo "Running pre-push gate (tox -e pre-push — mirrors CI exactly)..."
tox -e pre-push

exit_code=$?

if [ "$exit_code" -ne 0 ]; then
    echo ""
    echo "BLOCKED: pre-push gate failed. Fix the issues above before pushing."
    exit 1
fi
