diff --git a/aux/pull-n-build.sh b/aux/pull-n-build.sh index a64afac..c5f014d 100755 --- a/aux/pull-n-build.sh +++ b/aux/pull-n-build.sh @@ -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