add post-commit hook

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-12-24 12:05:10 +01:00
parent 69ca15a9d2
commit f4d64f7b0c
2 changed files with 26 additions and 2 deletions

24
dev/hooks/post-commit.sh Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
#### $$VERSION$$ v1.2-dev2-63-g69ca15a
############
# NOTE: you MUST run install-hooks.sh again when updating this file!
# 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
export HOOKDIR="dev/hooks"
LASTPUSH='.git/.lastcommit'
# if any command inside script returns error, exit and return that error
set -e
#echo "Running post-commit hook"
#echo "............................"
unset IFS; set -f
# note date of last push for version
touch "${LASTPUSH}"

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# this has to run once atfer git clone
# and every time we create new hooks
#### $$VERSION$$ v1.2-0-gc50499c
#### $$VERSION$$ v1.2-dev2-63-g69ca15a
# magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script
@ -15,7 +15,7 @@ fi
HOOKDIR="dev/hooks"
echo -n "Installing hooks..."
for hook in pre-commit pre-push
for hook in pre-commit post-commit pre-push
do
rm -f "${GIT_DIR}/hooks/${hook}"
if [ -f "${HOOKDIR}/${hook}.sh" ]; then