telegram-bot-bash/dev/install-hooks.sh
Kay Marquardt (Gnadelwartz) 1048d89648 prepare for sync with master
2019-04-22 10:19:16 +02:00

23 lines
592 B
Bash
Executable File

#!/usr/bin/env bash
# this has to run once atfer git clone
# and every time we create new hooks
#### $$VERSION$$ 0.70-dev-26-gbca3e59
# magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script
GIT_DIR=$(git rev-parse --git-dir)
cd "$GIT_DIR/.." || exit 1
HOOKDIR="dev/hooks"
echo -n "Installing hooks..."
for hook in pre-commit pre-push
do
rm -f "${GIT_DIR}/hooks/${hook}"
if [ -f "${HOOKDIR}/${hook}.sh" ]; then
echo -n " $hook"
ln -s "../../${HOOKDIR}/${hook}.sh" "${GIT_DIR}/hooks/${hook}"
fi
done
echo " Done!"