From ccb6f9c685ff72828388a4e0d6750559325cd378 Mon Sep 17 00:00:00 2001 From: orbea Date: Fri, 22 Dec 2017 10:53:04 -0800 Subject: [PATCH] libretro-buildbot-recipe.sh: Skip build if the .git directory is broken. --- libretro-buildbot-recipe.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libretro-buildbot-recipe.sh b/libretro-buildbot-recipe.sh index 364dde36..3ab02cf4 100755 --- a/libretro-buildbot-recipe.sh +++ b/libretro-buildbot-recipe.sh @@ -602,6 +602,12 @@ while read line; do git clone --depth=1 -b "$GIT_BRANCH" "$URL" "$DIR" BUILD="YES" UPDATE="NO" + else + HEAD="$(git --work-tree="$DIR" --git-dir="$DIR/.git" rev-parse HEAD)" || \ + { echo 'git directory broken, removing $NAME and skipping.'; \ + rm -rfv -- "$DIR" && continue; } + echo "pulling changes from repo $URL..." + git --work-tree="$DIR" --git-dir="$DIR/.git" pull fi cd "$DIR" || { echo "Failed to cd to ${DIR}, skipping ${NAME}"; continue; } @@ -624,10 +630,6 @@ while read line; do BUILD="YES" fi - echo "pulling changes from repo $URL..." - HEAD="$(git rev-parse HEAD)" - git pull - if [ "$HEAD" = "$(git rev-parse HEAD)" ] && [ "${BUILD}" != "YES" ]; then BUILD="NO" else