summaryrefslogtreecommitdiff
path: root/Omni/Ide/hooks/pre-commit
diff options
context:
space:
mode:
Diffstat (limited to 'Omni/Ide/hooks/pre-commit')
-rwxr-xr-xOmni/Ide/hooks/pre-commit21
1 files changed, 21 insertions, 0 deletions
diff --git a/Omni/Ide/hooks/pre-commit b/Omni/Ide/hooks/pre-commit
new file mode 100755
index 0000000..06f1716
--- /dev/null
+++ b/Omni/Ide/hooks/pre-commit
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+#
+# - prevent frozen code from being checked in
+# - guard against lint errors
+##
+ set -e
+ mapfile -t changed < <(git diff-index --cached --name-only HEAD)
+ for ns in "${changed[@]}"
+ do
+ version=$("${CODEROOT:?}"/Omni/Ide/version.sh "$ns")
+ if [[ $version -eq -1 ]]; then
+ echo "info: version: $ns: deleted"
+ elif [[ $version -lt 1 ]]; then
+ echo "fail: version: $ns: $version"
+ exit 1
+ else
+ echo "info: version: $ns: $version"
+ fi
+ done
+ lint "${changed[@]}"
+##