okf-wiki/tools/install-hooks.sh
Kjell Tore Guttormsen 0fd86a23a3
okf-wiki 1.1.1
First public release, published as one snapshot. What changed between
versions is in CHANGELOG.md.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 21:03:20 +01:00

13 lines
721 B
Bash
Executable file

#!/bin/bash
# install-hooks.sh - installs the repository-local git hooks that run the
# excluded-terms check before every commit (staged files) and on every commit
# message. The machine's global hook dispatcher runs these after its own rules.
# Run once per clone. bash 3.2 safe, ASCII only.
set -eu
ROOT=$(git rev-parse --show-toplevel)
HOOKS="$(git rev-parse --git-common-dir)/hooks"
mkdir -p "$HOOKS"
printf '#!/bin/bash\nexec "%s/tools/check-excluded-terms.sh" --staged\n' "$ROOT" > "$HOOKS/pre-commit"
printf '#!/bin/bash\nexec "%s/tools/check-excluded-terms.sh" --message "$1"\n' "$ROOT" > "$HOOKS/commit-msg"
chmod +x "$HOOKS/pre-commit" "$HOOKS/commit-msg"
echo "installed: $HOOKS/pre-commit, $HOOKS/commit-msg"