Trying to implement both "post-commit" and "post-receive" together

This commit is contained in:
Pierre Pronchery 2014-08-29 03:57:08 +02:00
parent ab5238ef12
commit ca64142d25

View File

@ -34,9 +34,23 @@ _error()
#hook_post_commit
_hook_post_commit()
{
if [ $# -ne 0 ]; then
_usage "post-commit"
return $?
fi
while read oldrev newrev refname; do
#XXX ignore errors
_hook_post_receive "$refname" "$oldrev" "$newrev"
done
return 0
}
_hook_post_receive()
{
if [ $# -ne 3 ]; then
_usage "post-commit refname oldrev newrev"
_usage "post-receive refname oldrev newrev"
return $?
fi
refname="$1"
@ -100,6 +114,10 @@ case "$hook" in
_hook_post_commit "$@"
exit $?
;;
"post-receive")
_hook_post_receive "$@"
exit $?
;;
*)
_error "$hook: Unknown hook"
exit $?