Created
April 5, 2012 23:48
-
-
Save ConsoleCatzirl/2315182 to your computer and use it in GitHub Desktop.
Meta git hook
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 | |
| # 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