gitolite/hooks/common/post-receive.mirrorpush
Sitaram Chamarty 68b45e1616 (new mirroring) bulk of the changes are here:
- post-receive now just calls mirror-push
  - mirror-push is a medium complex shell script (all that backgrounding
    etc., can't be done so easily in God's first language!)
  - mirror-shell is now a perl program that does a few different things
    (receive mirror-pushes, command line re-sync, re-sync requests from a
    slave, etc)
  - auth-command changes to reject/redirect non-native pushes
2011-08-12 22:51:44 +05:30

23 lines
955 B
Bash
Executable file

#!/bin/bash
# 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" ] && { echo $0: GL_REPO not set -- this is BAD >&2; exit 1; }
[ -z "$GL_BINDIR" ] && { echo $0: GL_BINDIR not set -- this is BAD >&2; exit 1; }
$GL_BINDIR/gl-mirror-push $GL_REPO