summaryrefslogtreecommitdiffstats
path: root/hooks
diff options
context:
space:
mode:
authorLectem <lectem@gmail.com>2015-05-31 13:24:23 +0200
committerLectem <lectem@gmail.com>2015-06-09 19:59:39 +0200
commit85183a702ab342de03d7a8d7b73e1fb0f7e346f2 (patch)
tree4fcf5606b0a3d564ef62e28ec13aee70b5fdb5f1 /hooks
parentMerge pull request #805 from lioncash/warn (diff)
downloadyuzu-85183a702ab342de03d7a8d7b73e1fb0f7e346f2.tar
yuzu-85183a702ab342de03d7a8d7b73e1fb0f7e346f2.tar.gz
yuzu-85183a702ab342de03d7a8d7b73e1fb0f7e346f2.tar.bz2
yuzu-85183a702ab342de03d7a8d7b73e1fb0f7e346f2.tar.lz
yuzu-85183a702ab342de03d7a8d7b73e1fb0f7e346f2.tar.xz
yuzu-85183a702ab342de03d7a8d7b73e1fb0f7e346f2.tar.zst
yuzu-85183a702ab342de03d7a8d7b73e1fb0f7e346f2.zip
Diffstat (limited to 'hooks')
-rw-r--r--hooks/pre-commit23
1 files changed, 23 insertions, 0 deletions
diff --git a/hooks/pre-commit b/hooks/pre-commit
new file mode 100644
index 000000000..44010fa1a
--- /dev/null
+++ b/hooks/pre-commit
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+#check the config, in case the user really wants to allow tabs...
+allowtabs=$(git config hooks.allowtabs)
+if [ "$allowtabs" != "true" ] &&
+ git diff --cached | egrep '^\+.* '
+then
+ cat<<END;
+Error: This commit would contain a tab, which is against this repo's policy.
+END
+ exit 1
+fi
+
+# If there are whitespace errors, print the offending file names and fail.
+if
+# Use git built-in checks for trailing whitespaces
+ ! git diff --check --cached
+then
+ cat<<END;
+Error: This commit would contain trailing spaces, which is against this repo's policy.
+END
+ exit 1
+fi