#!/bin/sh
# Pre-commit gate for the T-Deck workspace: run the fast headless test layer
# (unit + integration, deterministic, seconds) before every commit, so a
# regression can never land silently.
#
#   skip once:   git commit --no-verify
#   disable:     git config --unset core.hooksPath
#   (re)install: make hooks

echo "[pre-commit] running fast tests (make netdeck-test-unit)..."
make netdeck-test-unit || {
    echo "" >&2
    echo "[pre-commit] FAST TESTS FAILED - commit aborted." >&2
    echo "             Fix the failures above, or bypass once with: git commit --no-verify" >&2
    exit 1
}
echo "[pre-commit] fast tests OK"
