summaryrefslogtreecommitdiff
path: root/.githooks
diff options
context:
space:
mode:
Diffstat (limited to '.githooks')
-rwxr-xr-x.githooks/pre-commit10
1 files changed, 8 insertions, 2 deletions
diff --git a/.githooks/pre-commit b/.githooks/pre-commit
index 5ba733d..0af6083 100755
--- a/.githooks/pre-commit
+++ b/.githooks/pre-commit
@@ -1,5 +1,11 @@
#!/bin/sh
set -eu
-git ls-files -z --cached -- '*.caddy' 'Caddyfile' '*/Caddyfile' |
- xargs -0 -r caddy fmt --overwrite \ No newline at end of file
+for file in Caddyfile site/cgit/Caddyfile; do
+ caddy fmt --overwrite "$file"
+done
+
+if ! git diff --quiet -- Caddyfile site/cgit/Caddyfile; then
+ echo "Caddyfiles were formatted. Review and stage the changes."
+ exit 1
+fi \ No newline at end of file