2011-10-16 14:02:30 +02:00
|
|
|
#!/bin/sh
|
2010-08-10 10:12:52 +02:00
|
|
|
|
|
|
|
# gitolite mirroring
|
|
|
|
|
|
|
|
# please see doc/mirroring.mkd for instructions on how to use this
|
|
|
|
|
2011-12-02 05:14:57 +01:00
|
|
|
die() { echo post-receive.mirrorpush: "$@" >&2; exit 1; }
|
|
|
|
|
2011-03-16 14:51:31 +01:00
|
|
|
# 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
|
|
|
|
|
2011-12-02 05:21:40 +01:00
|
|
|
# even slaves have post-receive hooks, so we bail when a mirrored push happens
|
2011-08-12 18:38:28 +02:00
|
|
|
[ -n "$GL_BYPASS_UPDATE_HOOK" ] && exit 0
|
|
|
|
|
2011-12-02 05:21:40 +01:00
|
|
|
# CAUTION: a server-side push (bypassing gitolite) will not be mirrored
|
|
|
|
# automatically because we don't know GL_REPO (we can deduce it but we won't!)
|
2011-08-14 06:36:16 +02:00
|
|
|
[ -z "$GL_REPO" ] && die GL_REPO not set
|
|
|
|
[ -z "$GL_BINDIR" ] && die GL_BINDIR not set
|
2011-08-12 18:38:28 +02:00
|
|
|
|
2011-08-14 06:36:16 +02:00
|
|
|
slaves=`git config --get gitolite.mirror.slaves`
|
|
|
|
[ -z "$slaves" ] && exit 0
|
|
|
|
$GL_BINDIR/gl-mirror-push $GL_REPO $slaves
|