Skip to content

checkpatch: add --branch option to check commits in current branch

[email protected] lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1checkpatch: add --branch option to check commits in current branchscripts/checkpatch.pl+68 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] checkpatch: add --branch option to check commits in current branch

From: Carlos Bilbao <[email protected]>

I thought it would help to add an option --branch in checkpatch.pl to check multiple commits within a branch. In my experience, after creating a new experimental branch, I often need to generate multiple patches and run the script on each one individually. If there's an issue, I've to go back, which IMHO is little tedious. That's why I think this option may help reduce manual work. Below are some tests on the expected behavior.

No new commits since upstream:

$ git checkout -b up-to-date
$ git branch --set-upstream-to=check_branch up-to-date
$ ./scripts/checkpatch.pl --branch
Using as upstream branch: check_branch
No commits found between check_branch and up-to-date. Exiting.

With two new commits:

$ git commit --allow-empty -m "Commit 1"
$ git commit --allow-empty -m "Commit 2"
$ ./scripts/checkpatch.pl --branch
Using as upstream branch: check_branch
Checking 2 commits...
ERROR: Does not appear to be a unified-diff format patch

As edge case, with unconfigured upstream:

18:54 [linux][check_branch ?]$ git branch
* check_branch
docs-next
18:54 [linux][check_branch ?]$ ./scripts/checkpatch.pl --branch No explicit upstream branch found in reflog, trying git branch -vv. No upstream branch found. Would you like to specify one? [y/n] n Using as upstream branch: master
No commits found between master and check_branch. Exiting.

but if the user is willing to help:

18:54 [linux][check_branch ?]$ ./scripts/checkpatch.pl --branch No explicit upstream branch found in reflog, trying git branch -vv. No upstream branch found. Would you like to specify one? [y/n] y Please enter: docs-next
Using as upstream branch: docs-next
Checking 1 commits...
WARNING: Missing commit description - Add an appropriate one

ERROR: Missing Signed-off-by: line(s)

total: 1 errors, 1 warnings, 89 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

Commit 90dd5899dfd3 ("test") has style problems, please review.

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
18:54 [linux][check_branch ?]$

Carlos:
checkpatch: add --branch option to check commits in current branch