#! /bin/bash

if [ $# -ne 1 ]; then
	echo "usage: $0 <git-repo>"
	exit 1
fi

set -eu

if [ ! -d "$1" ]; then
    git init "$1"
fi

cd $1
git config --add receive.denycurrentbranch ignore
ln -s /usr/bin/gasp-publish .git/hooks/post-update

echo "Setup complete for $(git rev-parse --show-toplevel)"
