diff options
| -rwxr-xr-x | ci/buildserver-build.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ci/buildserver-build.sh b/ci/buildserver-build.sh index d932f6825d..b178e162a1 100755 --- a/ci/buildserver-build.sh +++ b/ci/buildserver-build.sh @@ -156,8 +156,15 @@ function checkout_ref { # Clean our working dir and check out the code we want to build rm -r dist/ 2&>/dev/null || true - git reset --hard + + # Reset to main in case there is some issue on the current branch that prevents resetting to it. + git reset --hard origin/main + git checkout "$ref" + + # Return an error if it's not possible to reset to the current branch. Some errors will result in exit code 0 from `checkout` but >0 from `reset`. + git reset --hard || return 1 + git submodule update git submodule update --init wireguard-go-rs/libwg/wireguard-go || true git clean -df |
