Add formatting check to pre-commit

This commit is contained in:
Riyyi
2026-08-03 22:14:41 +02:00
parent b3da887cc8
commit 6820a3842d
4 changed files with 19 additions and 2 deletions
+12
View File
@@ -2,5 +2,17 @@
SCRIPT_DIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
git stash push --keep-index --quiet
"$SCRIPT_DIR/../fmt.sh"
if ! git diff --quiet; then
echo "Formatting changed staged files; commit aborted."
git checkout -- "$SCRIPT_DIR/.."
git stash pop --quiet
exit 1
fi
"$SCRIPT_DIR/../test.sh"
git stash pop --quiet