Add support for the hooks setup by pagure itself on dist-git

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2017-10-06 09:55:47 +02:00
parent a1fd28c04c
commit 59fe50e3f1
2 changed files with 29 additions and 2 deletions

View file

@ -12,3 +12,25 @@ pee \
# We used to send emails directly from the git hook here, but now we send to
# fedmsg which routes to FMN which routes to packagers and the mailing list.
#$GIT_DIR/hooks/post-receive-chained.d/post-receive-email \
# Mechanism to support pagure's hook as well
hookname=`basename $0`
FILE=`mktemp`
trap 'rm -f $FILE' EXIT
cat - > $FILE
for hook in $GIT_DIR/hooks/$hookname.*
do
if test -x "$hook"; then
cat $FILE | $hook "$@"
status=$?
if test $status -ne 0; then
echo Hook $hook failed with error code $status
exit $status
fi
fi
done