Skip to content

Instantly share code, notes, and snippets.

@mythmon
Created April 5, 2012 23:52
Show Gist options
  • Save mythmon/2315223 to your computer and use it in GitHub Desktop.
Save mythmon/2315223 to your computer and use it in GitHub Desktop.
#!/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
read input
# 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}"
echo $input | . ${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