#!/bin/bash
# auto-deploy
# Usage: auto-deploy /srv/http/repo

# fail on any error
set -e

# Can we write on the clone?
test -w "${1}/.git/HEAD"

alias git="git --git-dir '${1}/.git' --work-tree '${1}'"

# pull this repo on the current branch
git pull origin $(git rev-parse --abbrev-ref HEAD)

exit $?