]> git.ipfire.org Git - people/ms/nightly-builds.git/blobdiff - build.sh
build.sh: Set the correct branch name
[people/ms/nightly-builds.git] / build.sh
index b17b9580f1b9b65acc3ac3e015e5324d01e81161..231e1a779724f3c118d7b08d452288c5ed5db218 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -58,6 +58,11 @@ build() {
        local commit_new="$(git rev-parse origin/${branch})"
        [ "${commit_old}" = "${commit_new}" ] && return 2
 
+       local current_branch="$(git rev-parse --abbrev-ref HEAD)"
+       if [ "${current_branch}" != "${branch}" ]; then
+               git checkout -b "${branch}" "${commit_new}"
+       fi
+
        # Checkout the latest commit
        git reset --hard "${commit_new}"