From 2f67ac9eafde3f9979224ce6ce30de3d5f3e1862 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 22 Apr 2018 09:35:23 +0200 Subject: [PATCH] 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. --- contrib/rh-bkr/build-from-source.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/contrib/rh-bkr/build-from-source.sh b/contrib/rh-bkr/build-from-source.sh index 50c7329e95..8eeb5287b5 100755 --- a/contrib/rh-bkr/build-from-source.sh +++ b/contrib/rh-bkr/build-from-source.sh @@ -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