build-from-source: also fetch refs for pull requests when building

When somebody creates a pull request against NetworkManager's github
repository, the github repository itself usually doesn't have a branch
that references the pull request.

Hence, the commit will not be fetched by default and checking out
the commit will fail.

Also add and fetch the refs for the pull request.
This commit is contained in:
Thomas Haller 2018-04-22 09:35:23 +02:00
parent 01c880540b
commit 2f67ac9eaf

View file

@ -81,7 +81,14 @@ if ! timeout 10m git clone "$BUILD_REPO"; then
fi
cd "./NetworkManager/"
git checkout "$BUILD_ID"
# 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/tags/*:refs/nmbuild-origin/tags/*'
git config --add remote.origin.fetch '+refs/pull/*:refs/nmbuild-origin/pull/*'
git fetch origin
git checkout -B nmbuild "$BUILD_ID"
echo "HEAD is $(git rev-parse HEAD)"
if [[ "$DO_TEST_BUILD" == yes ]]; then