libretro-buildbot-recipe.sh: Fix builds with force pushes.

The script will no longer git pull, but will fetch the any changes
from the remote branch and then reset the repo to that branch.

If there are changes the HEAD commit will change and it will rebuild.

This will also work if the old history was changed instead of the new
history.
This commit is contained in:
orbea 2018-01-07 08:08:42 -08:00
parent b4c688b9a5
commit 22b5a94ff5

View File

@ -619,15 +619,17 @@ while read line; do
HEAD="$(git --work-tree="$DIR" --git-dir="$DIR/.git" rev-parse HEAD)" || \
{ echo "git directory broken, removing $DIR and skipping $NAME."; \
rm -rfv -- "$DIR" && continue; }
echo "pulling changes from repo $URL..."
git --work-tree="$DIR" --git-dir="$DIR/.git" pull
echo "fetching changes from repo $URL..."
git --work-tree="$DIR" --git-dir="$DIR/.git" fetch origin "$GIT_BRANCH"
echo "resetting repo state $URL..."
git --work-tree="." --git-dir=".git" -C "$DIR" reset --hard FETCH_HEAD
git --work-tree="$DIR" --git-dir="$DIR/.git" clean -xdf -e .libretro-core-recipe
if [ "$HEAD" = "$(git --work-tree="$DIR" --git-dir="$DIR/.git" rev-parse HEAD)" ] && [ "${BUILD}" != "YES" ]; then
BUILD="NO"
else
echo "resetting repo state $URL..."
git --work-tree="$DIR" --git-dir="$DIR/.git" reset --hard FETCH_HEAD
git --work-tree="$DIR" --git-dir="$DIR/.git" clean -xdf -e .libretro-core-recipe
BUILD="YES"
fi
fi