Last active
April 29, 2016 18:31
-
-
Save paunin/649874a960d4eea1d5d6 to your computer and use it in GitHub Desktop.
git hook-chain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# http://stackoverflow.com/questions/8730514/chaining-git-hooks | |
# author: orefalo | |
hookname=`basename $0` | |
FILE=`mktemp` | |
trap 'rm -f $FILE' EXIT | |
cat - > $FILE | |
for hook in $GIT_DIR/hooks/$hookname.* | |
do | |
if test -x "$hook"; then | |
# echo $hook | |
cat $FILE | $hook "$@" | |
status=$? | |
if test $status -ne 0; then | |
echo Hook $hook failed with error code $status | |
exit $status | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment