summaryrefslogtreecommitdiff
path: root/Biz/Ide/hooks/post-checkout
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2024-04-01 16:35:15 -0400
committerBen Sima <ben@bsima.me>2024-04-01 16:35:15 -0400
commit99e114f5c598ce6321c81bbe41e212877a3c375c (patch)
tree07b2ac7c96c0970291bce7691aa58054bd1f965a /Biz/Ide/hooks/post-checkout
parent4c7327d144a1e1fd2bd2cfa6a9c49b838674bdd8 (diff)
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.
Diffstat (limited to 'Biz/Ide/hooks/post-checkout')
-rwxr-xr-xBiz/Ide/hooks/post-checkout19
1 files changed, 19 insertions, 0 deletions
diff --git a/Biz/Ide/hooks/post-checkout b/Biz/Ide/hooks/post-checkout
new file mode 100755
index 0000000..e4a0d67
--- /dev/null
+++ b/Biz/Ide/hooks/post-checkout
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+set -e
+mktags=${CODEROOT:?}/Biz/Ide/mktags.sh
+old=$1
+new=$2
+# filter out only the changed haskell files
+mapfile -t changed < <(git diff --diff-filter=d --name-only "$old" "$new" -- '*.hs')
+if [[ ! -r tags ]] || [[ ! -r TAGS ]]
+then
+ $mktags "$CODEROOT"/**/*
+elif [[ ${#changed[@]} -gt 0 ]]
+then
+ $mktags "${changed[@]}"
+fi
+direnv reload
+## START BRANCHLESS CONFIG
+
+git branchless hook post-checkout "$@"
+## END BRANCHLESS CONFIG