mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 10:30:22 +01: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 (cherry picked from commit3019648b4b) (cherry picked from commit9a37702311)
This commit is contained in:
parent
6dde55e22b
commit
67128fe6c0
2 changed files with 7 additions and 1 deletions
|
|
@ -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…
Add table
Reference in a new issue