From c2275b79f810980bc493d33fdd467d67ceb2c4b3 Mon Sep 17 00:00:00 2001 From: orbea Date: Sat, 2 Dec 2017 10:55:16 -0800 Subject: [PATCH] libretro-buildbot-recipe.sh: Always use the branch in the recipe file. If the checked out branch does not match the branch name in the recipe file the script will now make a shallow fetch of the correct branch, checkout the new branch and then remove the old one. If this is done it will also build a core with the new branch. --- libretro-buildbot-recipe.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libretro-buildbot-recipe.sh b/libretro-buildbot-recipe.sh index a6e8acd7..dbd400b7 100755 --- a/libretro-buildbot-recipe.sh +++ b/libretro-buildbot-recipe.sh @@ -750,6 +750,18 @@ while read line; do cd "$DIR" + CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + + if [ "${GIT_BRANCH}" != "${CURRENT_BRANCH}" ]; then + echo "Changing to the branch ${GIT_BRANCH} from ${CURRENT_BRANCH}" + git remote set-branches origin "${GIT_BRANCH}" + git fetch --depth 1 origin "${GIT_BRANCH}" + git checkout "${GIT_BRANCH}" + git branch -D "${CURRENT_BRANCH}" + BUILD="YES" + UPDATE="NO" + fi + if [ "${UPDATE}" != "NO" ]; then if [ -f .forcebuild ]; then echo "found .forcebuild file, building $NAME"