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

19 lines
458 B
Bash
Raw Normal View History

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