diff options
| author | Thomas Haller <thaller@redhat.com> | 2018-10-22 13:35:20 +0200 |
|---|---|---|
| committer | Thomas Haller <thaller@redhat.com> | 2018-10-22 13:57:52 +0200 |
| commit | f41a69d416e08b6d7b78caa94d4b8a33af2bc29e (patch) | |
| tree | 64e7c91cf6fd83a1821798901cdbbc80387db51f | |
| parent | 52542cbf6ab40c2799830c20cd4d239bd13f8fe1 (diff) | |
| download | NetworkManager-f41a69d416e08b6d7b78caa94d4b8a33af2bc29e.tar.gz | |
checkpatch: fix "checkpatch-feature-branch.sh" for master branch
The main purpose of "checkpatch-feature-branch.sh" is to test all
patches of a feature branch. When we run the script against master
(or nm-1-*), then there is no feature branch.
Previously, the script would just error out.
That is not very useful, in particular as we call this from gitlab-ci,
which also runs on master.
Instead, in that case, test the HEAD.
(cherry picked from commit 4543785438c5859799e9c68b80e63e30be5df82e)
| -rwxr-xr-x | contrib/scripts/checkpatch-feature-branch.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/scripts/checkpatch-feature-branch.sh b/contrib/scripts/checkpatch-feature-branch.sh index 6741317be2..2e0b589194 100755 --- a/contrib/scripts/checkpatch-feature-branch.sh +++ b/contrib/scripts/checkpatch-feature-branch.sh @@ -17,7 +17,11 @@ RANGES=( $(git show-ref | sed 's#^\(.*\) '"$BASE_REF"'\(master\|nm-1-[0-9]\+\)$# REFS=( $(git log --reverse --format='%H' "${RANGES[@]}") ) -[ "${#REFS[@]}" != 0 ] || die "no refs detected (HEAD is $(git rev-parse HEAD))" +if [ "${#REFS[@]}" == 0 ] ; then + # no refs detected. This means, $HEAD is already on master (or one of the + # stable nm-1-* branches. Just check the patch itself. + REFS=( $HEAD ) +fi SUCCESS=0 for H in ${REFS[@]}; do |
