Instructions
-
Add the hook-chain script to the repository hooks
-
Create a link symbolic to hook-chain with the name of the hook which will be chained
- Eg:
post-receive -> hook-chain
- Add scripts prefixed with the [hookname].
Just that.
Have Fun!!!
Instructions
Add the hook-chain script to the repository hooks
Create a link symbolic to hook-chain with the name of the hook which will be chained
post-receive -> hook-chainJust that.
Have Fun!!!
| #!/bin/bash | |
| hookname=`basename $0` | |
| # reads stdin and saveS IT | |
| data=$(cat) | |
| # array to save exit codes of each script | |
| exitcodes=() | |
| # loop through multiple hook scripts and call then | |
| # scripts should be named like post-receive-push_to_mirror, post-receive-notify, etc | |
| for hook in $GIT_DIR/hooks/$hookname-* | |
| do | |
| test -x "$hook" || continue | |
| echo "$data" | "$hook" | |
| exitcodes+=($?) | |
| done | |
| # If any exit code isn't 0, fail. | |
| for i in "${exitcodes[@]}"; do | |
| [ "$i" == 0 ] || exit $i | |
| done |
Hi @abner,
I would like to build this into something installable please.
I know this is a small file, but would you care to give it your preferred copyleft? Or if it's not your work, tell me where it came from?
Thanks,