From 0e709abc287b68928b82e2c93e89e9b076aaa42d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Fri, 30 Jul 2021 01:12:26 +0200 Subject: [PATCH] build_nim.sh: deal with old local branches used as Nim targets (#23) --- scripts/build_nim.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/build_nim.sh b/scripts/build_nim.sh index 868cfec..61c9c18 100755 --- a/scripts/build_nim.sh +++ b/scripts/build_nim.sh @@ -68,6 +68,9 @@ nim_needs_rebuilding() { git fetch --all git checkout -q ${NIM_COMMIT} fi + # In case NIM_COMMIT is a local branch that's behind the remote one it's tracking. + git pull -q 2>/dev/null || true + git checkout -q ${NIM_COMMIT} # We can't use "rev-parse" here, because it would return the tag object's # hash instead of the commit hash, when NIM_COMMIT is a tag. NIM_COMMIT_HASH="$(git rev-list -n 1 ${NIM_COMMIT})"