Fix setup_git_package to handle setting up after gitolite setup a broken repo

setup_git_package did the same check as pkgdb_sync did [1].

Also, if gitolite already came by, it will have created an update hook, which blocks us from pushing the initial commit (since gitolite has no idea who we are).
So in that case, we will just remove the update hook: gitolite will recreate it when it comes by the repo with genacls.sh.

The change to mkdir -p is just synto make it not print an error in case the directory already existed.

[1]: https://lists.fedoraproject.org/pipermail/infrastructure/2015-February/015600.html

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
Patrick Uiterwijk 2015-02-27 23:39:59 +00:00
parent 6bb938abfe
commit 6e98a2dc66

View file

@ -68,11 +68,17 @@ fi
# Sanity checks before we start doing damage
[ $VERBOSE -gt 1 ] && echo "Checking package $PACKAGE..."
if [ -d $GITROOT/$PACKAGE.git ] ; then
if [ -f $GITROOT/$PACKAGE.git/refs/heads/master ] ; then
echo "ERROR: Package module $PACKAGE already exists!" >&2
exit -1
fi
# A cleanup in case gitolite came by this repo
if [ -f $GITROOT/$PACKAGE.git/hooks/update ] ; then
echo "Gitolite already initialized this repo. Will remove its hooks"
rm -f $GITROOT/$PACKAGE.git/hooks/update
fi
# "global" permissions check
if [ ! -w $GITROOT ] ; then
echo "ERROR: You can not write to $GITROOT"
@ -85,7 +91,7 @@ fi
TMPDIR=$(mktemp -d /tmp/tmpXXXXXX)
# First create the master repo
mkdir $GITROOT/$PACKAGE.git
mkdir -p $GITROOT/$PACKAGE.git
pushd $GITROOT/$PACKAGE.git >/dev/null
git init -q --shared --bare
echo "$PACKAGE" > description # This is used to figure out who to send mail to.