telegram-bot-bash/test/install-hooks.sh
Kay Marquardt (Gnadelwartz) ebd9e6fb9f fix cd base dir
2019-04-18 18:42:42 +02:00

21 lines
554 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-0-g209c4b3
# 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
echo -n "Installing hooks..."
for hook in pre-commit pre-push
do
rm -f "$GIT_DIR/hooks/${hook}"
if [ -f "test/${hook}.sh" ]; then
echo -n " $hook"
ln -s "../../test/${hook}.sh" "$GIT_DIR/hooks/${hook}"
fi
done
echo " Done!"