From fb910708bc7d6b4f3c16997ea894ced5fb07cccf Mon Sep 17 00:00:00 2001 From: orbea Date: Tue, 30 Apr 2019 21:12:08 -0700 Subject: [PATCH] libretro-buildbot-recipe.sh: Switch repos for new urls. If the current remote url is different from the new url in the recipe it will now remove the old repo and clone the new url before building. --- libretro-buildbot-recipe.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libretro-buildbot-recipe.sh b/libretro-buildbot-recipe.sh index 342cbbc1..fb7b172e 100755 --- a/libretro-buildbot-recipe.sh +++ b/libretro-buildbot-recipe.sh @@ -612,7 +612,14 @@ while read line; do { echo "git directory broken, removing $DIR and skipping $NAME."; \ rm -rfv -- "$DIR" && continue; } - if [ -z "${NOCLEAN}" ]; then + OLDURL="$(git --work-tree="$DIR" --git-dir="$DIR/.git" config --get remote.origin.url)" + + if [ "$URL" != "$OLDURL" ]; then + rm -rvf -- "$DIR" + echo "cloning repo $URL..." + git clone --depth=1 -b "$GIT_BRANCH" "$URL" "$DIR" + BUILD="YES" + elif [ -z "${NOCLEAN}" ]; then echo "fetching changes from repo $URL..." git --work-tree="$DIR" --git-dir="$DIR/.git" fetch --depth 1 origin "${GIT_BRANCH}"