diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 44aa2ed00c..bb38d67548 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -73,7 +73,7 @@ checkpatch: stage: test script: - date '+%Y%m%d-%H%M%S'; dnf install -y git - - date '+%Y%m%d-%H%M%S'; contrib/scripts/checkpatch-feature-branch.sh 2>&1 | tee checkpatch-out.txt + - date '+%Y%m%d-%H%M%S'; NM_CHECKPATCH_FETCH_UPSTREAM=1 contrib/scripts/checkpatch-feature-branch.sh 2>&1 | tee checkpatch-out.txt allow_failure: true artifacts: when: on_failure diff --git a/contrib/scripts/checkpatch-feature-branch.sh b/contrib/scripts/checkpatch-feature-branch.sh index 0f37728d9f..72e5903dae 100755 --- a/contrib/scripts/checkpatch-feature-branch.sh +++ b/contrib/scripts/checkpatch-feature-branch.sh @@ -15,6 +15,12 @@ if printf '%s' "$HEAD" | grep -q '\.\.'; then else BASE_REF="refs/remotes/origin/" + if [ "$NM_CHECKPATCH_FETCH_UPSTREAM" == 1 ]; then + git remote add nm-upstream https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git + git fetch nm-upstream || die "failure to fetch from https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git" + BASE_REF="refs/remotes/nm-upstream/" + fi + # the argument is only a single ref (or the default "HEAD"). # Find all commits that branch off one of the stable branches or master # and lead to $HEAD. These are the commits of the feature branch.