Skip to content

Instantly share code, notes, and snippets.

@milki
Created December 11, 2015 00:11
Show Gist options
  • Save milki/ce67af16eb284662fe1f to your computer and use it in GitHub Desktop.
Save milki/ce67af16eb284662fe1f to your computer and use it in GitHub Desktop.
#!/bin/bash
# gitolite mirror push <slave> <repo>
CMD=$1
SLAVE=$2
REPO=$3
script="$(gitolite query-rc GL_BINDIR)"/commands/mirror
GL_REPO_BASE="$(gitolite query-rc GL_REPO_BASE)"
lockfile="$GL_REPO_BASE/$REPO.git/$SLAVE"
if [ "$CMD" = 'push' ]
then
[ "${FLOCKER}" != "$SLAVE" ] && exec env FLOCKER="$SLAVE" flock -en "$lockfile" "$0" "$@" || :
fi
$script $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment