]> git.ipfire.org Git - people/ms/nightly-builds.git/commitdiff
build.sh: Set the correct branch name
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Feb 2020 22:49:06 +0000 (22:49 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Feb 2020 22:49:58 +0000 (22:49 +0000)
This is later used in the build to mark the build.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
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}"