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}"