gitlab: minor fixes for checkpatch CI job
cover gitlab: minor fixes for checkpatch CI job
This fixes a bogus error when pushing a branch whose content has no delta against upstream git master.
Daniel P. Berrangé (2):
gitlab: skip checkpatch.pl checks if no commit delta on branch
scripts: fix error from checkpatch.pl when no commits are found
.gitlab-ci.d/check-patch.py | 8 ++++++++ scripts/checkpatch.pl | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
2.26.2
PATCH 1/2 gitlab: skip checkpatch.pl checks if no commit delta on branch
If the current branch is synced to the current upstream git master, there are no commits that need checking. This causes checkpatch.pl to print an error that it found no commits. We need to avoid calling checkpatch.pl in this case.
--- .gitlab-ci.d/check-patch.py | 8 ++++++++ 1 file changed, 8 insertions(+)
.gitlab-ci.d/check-patch.py +8 -0
@@ -33,8 +33,16 @@ ancestor = subprocess.check_output(["git", "merge-base", ancestor = ancestor.strip() +log = subprocess.check_output(["git", "log", "--format=%H %s", + ancestor + "..."], + universal_newlines=True) + subprocess.check_call(["git", "remote", "rm", "check-patch"]) +if log == "": + print("\nNo commits since %s, skipping checks\n" % ancestor) + sys.exit(0) + errors = False print("\nChecking all commits since %s...\n" % ancestor)
Signature · 1 line
2.26.2
PATCH 2/2 scripts: fix error from checkpatch.pl when no commits are found
In reply to Daniel P. BerrangéThe error message was supposed to mention the input revision list start point, not the branch flag.
--- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
@@ -392,7 +392,7 @@ if ($chk_branch) { close $HASH; - die "$P: no revisions returned for revlist '$chk_branch'\n" + die "$P: no revisions returned for revlist '$ARGV[0]'\n" unless @patches; my $i = 1;
Signature · 1 line
2.26.2
Quoted 2 lines · Daniel P. Berrangé
This fixes a bogus error when pushing a branch whose content has no delta against upstream git master.
Queued to testing/next, thanks.
Quoted 8 lines
Daniel P. Berrangé (2):
gitlab: skip checkpatch.pl checks if no commit delta on branch
scripts: fix error from checkpatch.pl when no commits are found.gitlab-ci.d/check-patch.py | 8 ++++++++ scripts/checkpatch.pl | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
Alex Bennée