Add formatting check to pre-commit
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
PROJECT="sindri"
|
PROJECT="sindri"
|
||||||
VERSION="dev-$(date -u '+%Y-%m-%d')-$(git rev-parse --short HEAD)"
|
VERSION="dev-$(date -u '+%Y-%m-%d')-$(git rev-parse --short HEAD)"
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
odinfmt -w src/
|
set -e
|
||||||
|
|
||||||
|
odinfmt -w src/ > /dev/null
|
||||||
|
odinfmt -w tests/ > /dev/null
|
||||||
|
|||||||
@@ -2,5 +2,17 @@
|
|||||||
|
|
||||||
SCRIPT_DIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
|
SCRIPT_DIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
|
||||||
|
|
||||||
|
git stash push --keep-index --quiet
|
||||||
|
|
||||||
"$SCRIPT_DIR/../fmt.sh"
|
"$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"
|
"$SCRIPT_DIR/../test.sh"
|
||||||
|
|
||||||
|
git stash pop --quiet
|
||||||
|
|||||||
Reference in New Issue
Block a user