gitolite/hooks/common/post-receive.mirrorpush
2011-10-16 17:32:30 +05:30

25 lines
963 B
Bash
Executable file

#!/bin/sh
# gitolite mirroring
# please see doc/mirroring.mkd for instructions on how to use this
# flush STDIN coming from git; we have no use for that info in this hook but
# if you don't do this, git-shell sometimes dies of a signal 13 (SIGPIPE)
[ -t 0 ] || cat >/dev/null
# even slaves have post-receive hooks, but due to the way the push happens, we
# don't have GL_REPO set. So we detect that generic situation and bail...
[ -n "$GL_BYPASS_UPDATE_HOOK" ] && exit 0
# CAUTION: this means that a server-side push (bypassing gitolite) will not be
# mirrored automatically because (a) we don't know GL_REPO (we can deduce it
# but we won't!), and (b) we can't distinguish easily between that and this
# case (the slave receiving a mirror push case)
[ -z "$GL_REPO" ] && die GL_REPO not set
[ -z "$GL_BINDIR" ] && die GL_BINDIR not set
slaves=`git config --get gitolite.mirror.slaves`
[ -z "$slaves" ] && exit 0
$GL_BINDIR/gl-mirror-push $GL_REPO $slaves