#!/bin/sh
# Prüft vor jedem Push, was auch die CI prüft: Format, Clippy, Tests. Überspringen: SKIP_CHECKS=1 git push
# Einschalten (einmal pro Klon): git config core.hooksPath .githooks
[ -n "$SKIP_CHECKS" ] && exit 0
cd "$(git rev-parse --show-toplevel)" || exit 1
echo "pre-push: cargo fmt --check"; cargo fmt --check || { echo "→ Format: bitte 'cargo fmt' ausführen"; exit 1; }
echo "pre-push: cargo clippy";      cargo clippy --all-targets --locked -- -D warnings || exit 1
echo "pre-push: cargo test";        cargo test --locked || exit 1
