From 61c375a8fcdee54f76c03a63b3ab3a3b1cccc415 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Mon, 23 Sep 2013 19:57:18 +0000 Subject: [PATCH] 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 --- modules/jenkins/files/slave_scripts/gerrit-git-prep.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh b/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh index 582d6be11a..818edfcaa5 100755 --- a/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh +++ b/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh @@ -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