gitolite/hooks/common/update.secondary.sample

45 lines
1.4 KiB
Plaintext
Raw Normal View History

2011-10-16 14:02:30 +02:00
#!/bin/sh
# driver script to run multiple update "hooklets". Each "hooklet" performs a
# specific (possibly site-local) check, and they *all* have to succeed for the
# push to succeed.
# HOW TO USE:
2011-11-15 09:37:53 +01:00
# (1) rename this file to remove the .sample extension
# (2) make the renamed file executable (chmod +x)
# (3) put it in ~/.gitolite/hooks/common on the server
# (4) create a directory called update.secondary.d in the same place
# (5) copy all the update "hooklets" you want (like update.detect-dup-pubkeys)
# from contrib or wherever, to that directory
# (6) make them also executable (chmod +x)
2011-11-15 09:37:53 +01:00
# (7) run gl-setup
# rules for writing a hooklet are in the sample hooklet called
# "update.detect-dup-pubkeys" in contrib
# ----
# NOTE: a hooklet runs under the same assumptions as the 'update' hook, so the
# starting directory must be maintained and arguments must be passed on.
[ -d hooks/update.secondary.d ] || exit 0
# all output from these "hooklets" must go to STDERR to avoid confusing the client
exec >&2
for i in hooks/update.secondary.d/*
do
[ -x "$i" ] || continue
# call the hooklet with the same arguments we got
"$i" "$@" || {
# hooklet failed; we need to log it...
echo hooklet $i failed
perl -I$GL_BINDIR -Mgitolite -e "log_it('hooklet $i failed')"
# ...and send back some non-zero exit code ;-)
exit 1
}
done
exit 0