mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-14 12:05:03 +00:00
checkpatch,gitlab-ci: let checkpatch script compare against latest upstream master
When opening a merge request from a fork of NetworkManager, then the pipeline runs with the a checkout of the fork. That means, checkpatch would compare the branch against "master" (or "nm-x-y" stable branches) of the fork, instead of upstream. That doesn't seem too useful. Instead, also add upstream NetworkManager as git remote, fetch the branches, and use the branches from there as base for checkpatch. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/255
This commit is contained in:
parent
10e8f7fdb4
commit
3019648b4b
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue