Garbage collect Git repos in gerrit-git-prep

* modules/jenkins/files/slave_scripts/gerrit-git-prep.sh: Sometimes
Git repositories can be left in a dirty state, preventing subsequent
operations. If a git remote update fails, garbage collect and then
try again.

Change-Id: I8455a3193081f9a0c9372a10f5ffdbc25fc864d9
Fixes-Bug:1229352
This commit is contained in:
Jeremy Stanley 2013-09-23 19:57:18 +00:00
parent 6a8ec2c6ff
commit 61c375a8fc

View File

@ -42,7 +42,15 @@ then
git clone $GIT_ORIGIN/$ZUUL_PROJECT .
fi
git remote set-url origin $GIT_ORIGIN/$ZUUL_PROJECT
git remote update || git remote update # attempt to work around bug #925790
# attempt to work around bugs 925790 and 1229352
if ! git remote update
then
echo "The remote update failed, so garbage collecting before trying again."
git gc
git remote update
fi
git reset --hard
git clean -x -f -d -q