- # update all the mirrors
- self.update_mirrors(ref, oldsha, newsha, [mirror], suppress_stderr)
+ # Now run the post-receive hooks. This will *also* push the changes to all mirrors, as we
+ # are one of these hooks!
+ os.putenv("GIT_MIRROR_SOURCE", mirror) # tell ourselves which repo we do *not* have to update
+ with subprocess.Popen(['/bin/sh', 'hooks/post-receive'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) as p:
+ (stdout, stderr) = p.communicate("{0} {1} {2}\n".format(oldsha, newsha, ref).encode('utf-8'))
+ stdout = stdout.decode('utf-8')
+ if p.returncode:
+ raise Exception("post-receive git hook terminated with non-zero exit code {0}:\n{1}".format(p.returncode, stdout))
+ return stdout