Skip to content

Instantly share code, notes, and snippets.

@ConsoleCatzirl
Created April 5, 2012 23:48
Show Gist options
  • Save ConsoleCatzirl/2315182 to your computer and use it in GitHub Desktop.
Save ConsoleCatzirl/2315182 to your computer and use it in GitHub Desktop.
Meta git hook
#!/bin/bash
# run all the execuable scripts in the corresponding hook.d directory
# e.g. if this is the update hook, run all scripts in update.d/
while read oldrev newrev ref
do
for file in `find ./$0.d/ -type f`
do
if [ -x $file ]
then
echo "Running hook: $file"
# each hook expects our stdin
echo "$oldrev $newrev $ref" | $file
if [ ! $? ]
then
exit $?
fi
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment