Try a clean git-clone if pulling fails

This commit is contained in:
maride 2023-10-14 15:31:43 +02:00
parent 0d7b92f3d2
commit 4c22604a83

View File

@ -15,6 +15,15 @@ set -e -v
true
else
# repo URL set
if [ -d /repo ]; then
# repo already exists, try to pull
cd /repo && git pull --recurse-submodules
if [ "$?" -ne 0 ]; then
# pull failed, clean and retry to clone
echo "Pull failed, attempting to clean clone"
rm -rf /repo
fi
fi
if [ ! -d /repo ]; then
# repo needs to be cloned
# check if there is a specific branch to clone
@ -22,9 +31,6 @@ set -e -v
BRANCHCMD="--branch $REPO_BRANCH"
fi
git clone --recurse-submodules $BRANCHCMD $REPO_URL /repo
else
# no - pull existing repo
cd /repo && git pull --recurse-submodules
fi
fi