build-from-source: fix checking-out branches by name (2)

git doesn't like to fetch into a local branch which is currently
checked out.

  $ git fetch origin --prune
  fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository

We need to first checkout a plain commit (detached HEAD).

Fixes: 2f67ac9eaf
This commit is contained in:
Thomas Haller 2018-04-23 15:39:15 +02:00
parent b7ba495aa9
commit d8f99fe901

View file

@ -87,9 +87,10 @@ cd "./NetworkManager/"
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 checkout HEAD^{}
git fetch origin --prune
git checkout -B nmbuild "$BUILD_ID"
echo "HEAD is $(git rev-parse HEAD)"
if [[ "$DO_TEST_BUILD" == yes ]]; then