telegram-bot-bash/dev/install-hooks.sh

21 lines
484 B
Bash
Raw Normal View History

2019-04-18 18:38:20 +02:00
#!/usr/bin/env bash
# this has to run once atfer git clone
# and every time we create new hooks
2021-01-15 14:23:19 +01:00
#### $$VERSION$$ v1.30-dev-20-g541a279
2019-04-18 18:38:20 +02:00
2021-01-15 14:23:19 +01:00
#shellcheck disable=SC1090
source "${0%/*}/dev.inc.sh"
2019-04-18 18:38:20 +02:00
2019-04-19 10:43:06 +02:00
HOOKDIR="dev/hooks"
2021-01-01 11:27:54 +01:00
printf "Installing hooks..."
2020-12-24 12:05:10 +01:00
for hook in pre-commit post-commit pre-push
2019-04-18 18:38:20 +02:00
do
2019-04-19 13:01:25 +02:00
rm -f "${GIT_DIR}/hooks/${hook}"
2019-04-19 10:43:06 +02:00
if [ -f "${HOOKDIR}/${hook}.sh" ]; then
2021-01-05 11:40:28 +01:00
printf "%s"" ${hook}"
2019-04-19 10:43:06 +02:00
ln -s "../../${HOOKDIR}/${hook}.sh" "${GIT_DIR}/hooks/${hook}"
2019-04-18 18:38:20 +02:00
fi
done
2021-01-01 11:27:54 +01:00
printf " Done!\n"