public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: carlos.bilbao@kernel.org
To: apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com,
	lukas.bulwahn@gmail.com
Cc: bilbao@vt.edu, linux-kernel@vger.kernel.org,
	Carlos Bilbao <carlos.bilbao@kernel.org>
Subject: [PATCH 0/1] checkpatch: add --branch option to check commits in current branch
Date: Mon,  3 Feb 2025 19:28:21 -0600	[thread overview]
Message-ID: <20250204012822.1379477-1-carlos.bilbao@kernel.org> (raw)

From: Carlos Bilbao <carlos.bilbao@kernel.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


             reply	other threads:[~2025-02-04  1:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-04  1:28 carlos.bilbao [this message]
2025-02-04  1:28 ` [PATCH 1/1] checkpatch: add --branch option to check commits in current branch carlos.bilbao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250204012822.1379477-1-carlos.bilbao@kernel.org \
    --to=carlos.bilbao@kernel.org \
    --cc=apw@canonical.com \
    --cc=bilbao@vt.edu \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox