-
-
Save soundslikeinfo/2390707 to your computer and use it in GitHub Desktop.
[The post-receive hook that allows to selectively run git hooks.] #LegacyGISTS
This file contains hidden or 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 | |
# wrapper script for post-recieve | |
enabled_hooks="$(git config hooks.enabled)" | |
hooks_path="/usr/local/share/git/hooks/" | |
if [ -n "${enabled_hooks}" ] ; then | |
# change separate to comma | |
OLDIFS="$IFS" | |
IFS="," | |
for i in $enabled_hooks ; do | |
# reset IFS | |
IFS=$OLDIFS | |
# remove extra whitespace | |
hook="${hooks_path}${i//[[:space:]]}" | |
if [ -f ${hook} ] ; then | |
echo "executing ${hook}" | |
. ${hook} | |
else | |
echo "warning: ${hook} not found" | |
fi | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment