summaryrefslogtreecommitdiff
path: root/scripts/git-pre-commit-hook.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/git-pre-commit-hook.sh')
-rwxr-xr-xscripts/git-pre-commit-hook.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/git-pre-commit-hook.sh b/scripts/git-pre-commit-hook.sh
new file mode 100755
index 0000000..d6297e7
--- /dev/null
+++ b/scripts/git-pre-commit-hook.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e -u -o pipefail
+
+# All of this is output for humans, not programs.
+exec >&2
+
+unit="$(scripts/unit_test.sh)"
+if [ $? -ne 0 ]; then
+ echo "$unit"
+ echo "You have failing unit tests. Aborting git commit."
+ exit 1
+fi