From 99e114f5c598ce6321c81bbe41e212877a3c375c Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 1 Apr 2024 16:35:15 -0400 Subject: Make bild exception for git hooks Apparently git hooks don't get called if they have a file extention, so these weren't getting called at all since commit 904de577261e7024373e7a42fd763184764238f9. So this renames them back to the extension-less versions, and adds an exception in bild for files in the core.hooksPath directory. Unfortunately this means Lint.hs will silently ignore these files, but I guess that's okay for now. --- Biz/Ide/hooks/pre-commit | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 Biz/Ide/hooks/pre-commit (limited to 'Biz/Ide/hooks/pre-commit') diff --git a/Biz/Ide/hooks/pre-commit b/Biz/Ide/hooks/pre-commit new file mode 100755 index 0000000..b0f204a --- /dev/null +++ b/Biz/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:?}"/Biz/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[@]}" +## -- cgit v1.2.3