Merge "Add script for installing hooks" into main
diff --git a/install_hooks.sh b/install_hooks.sh new file mode 100755 index 0000000..90c3480 --- /dev/null +++ b/install_hooks.sh
@@ -0,0 +1,15 @@ +#! /usr/bin/env sh + +#git config --add hook.pre-commit.command `realpath +dir=`realpath $(dirname "$BASH_SOURCE:-0")` + +# Space separated list of hooks to install +declare -a HOOKS=("pre-commit" "commit-msg") + +for hook in ${HOOKS[@]}; do + if [ ! -f "${dir}/${hook}" ]; then + continue + fi + git config --add hook.${hook}.command "${dir}/${hook}" + git list hook "${hook}" +done