build-from-source: fix checking-out branches by name

Without it, `git checkout -B nmbuild nm-1-10` will fail, because
there is no local branch refs/heads/nm-1-10. Previously, it worked
because there was (one) refs/remotes/origin/nm-1-10, so if we didn't
specify "-B" option, git would create a remote-tracking local branch.

Fix it, by fetching the remote branches as local branches.

Fixes: 2f67ac9eaf
This commit is contained in:
Thomas Haller 2018-04-22 09:35:23 +02:00
parent 2f67ac9eaf
commit b7ba495aa9

View file

@ -84,9 +84,10 @@ cd "./NetworkManager/"
# if we fetch from a github repository, we also care about the refs to the pull-requests
# fetch them too.
git config --add remote.origin.fetch '+refs/heads/*:refs/heads/*'
git config --add remote.origin.fetch '+refs/tags/*:refs/nmbuild-origin/tags/*'
git config --add remote.origin.fetch '+refs/pull/*:refs/nmbuild-origin/pull/*'
git fetch origin
git fetch origin --prune
git checkout -B nmbuild "$BUILD_ID"
echo "HEAD is $(git rev-parse HEAD)"