Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 47 lines (42 sloc) 1.23 KB
# This script is used to push changes from gitmaster to the anonymous
# mirror. It's designed to be run (very frequently) from cron, and will
# run as soon as there are any refs that are newer than the last pull.
# Copyright (C) 2010 PostgreSQL Global Development Group
# Author: Magnus Hagander <>
# Released under the PostgreSQL license
# Can be run with --force to push even if nothing appears to have
# changed.
# The git repository should have a remote called "anonymous" configured.
# All branches will be pushed.
if [ "$1" == "" ]; then
echo "Usage: <path to git repository> [--force]"
exit 1
set -e
cd $1
M=$(find refs -type f -newer last_anonymous_push | grep -v refs/remotes/ | wc -l)
M=$(($M + $(find packed-refs -type f -newer last_anonymous_push | wc -l)))
if [ $M -gt 0 -o "$2" == "--force" ]; then
# Perform push in interlock
if [ ! -e /tmp/.git_repo_push.lck ]; then
trap "rm -f /tmp/.git_repo_push.lck" INT TERM EXIT
touch /tmp/.git_repo_push.lck
touch last_anonymous_push
git push anonymous --all >/dev/null
git push anonymous --tags >/dev/null
rm -f /tmp/.git_repo_push.lck
echo Push script already running.
Jump to Line
Something went wrong with that request. Please try again.