[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250204012822.1379477-1-carlos.bilbao@kernel.org>
Date: Mon, 3 Feb 2025 19:28:21 -0600
From: carlos.bilbao@...nel.org
To: apw@...onical.com,
joe@...ches.com,
dwaipayanray1@...il.com,
lukas.bulwahn@...il.com
Cc: bilbao@...edu,
linux-kernel@...r.kernel.org,
Carlos Bilbao <carlos.bilbao@...nel.org>
Subject: [PATCH 0/1] checkpatch: add --branch option to check commits in current branch
From: Carlos Bilbao <carlos.bilbao@...nel.org>
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
Powered by blists - more mailing lists