aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcontrib/pre-commit/whitespace20
1 files changed, 20 insertions, 0 deletions
diff --git a/contrib/pre-commit/whitespace b/contrib/pre-commit/whitespace
new file mode 100755
index 0000000..ee588cc
--- /dev/null
+++ b/contrib/pre-commit/whitespace
@@ -0,0 +1,20 @@
+#!/bin/bash -e
+
+function run_test {
+ if git rev-parse --verify HEAD >/dev/null 2>&1 ; then
+ head="HEAD"
+ else
+ # First commit, use an empty tree
+ head="4b825dc642cb6eb9a060e54bf8d69288fbee4904"
+ fi
+ git diff-index --check --cached "${head}" --
+}
+
+case "${1}" in
+ --about )
+ echo "Check for introduced trailing whitespace or an indent that uses a space before a tab."
+ ;;
+ * )
+ run_test
+ ;;
+esac