| 1 | #!/bin/sh |
| 2 | # SplitFire pre-commit hook: catch the things CI fails on, before you push. |
| 3 | # Enable with: git config core.hooksPath .githooks |
| 4 | |
| 5 | set -e |
| 6 | |
| 7 | # Only check staged Rust files; skip if none are staged. |
| 8 | if git diff --cached --name-only --diff-filter=ACM | grep -q '\.rs$'; then |
| 9 | echo "pre-commit: cargo fmt --check" |
| 10 | if ! cargo fmt -- --check; then |
| 11 | echo |
| 12 | echo "Formatting check failed. Run 'cargo fmt' and re-stage your changes." >&2 |
| 13 | exit 1 |
| 14 | fi |
| 15 | fi |