public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
	Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: <linux-kernel@vger.kernel.org>, Petr Machata <petrm@nvidia.com>
Subject: [PATCH v5] checkpatch: Tolerate upstream commit references
Date: Wed, 10 Sep 2025 14:34:01 +0200	[thread overview]
Message-ID: <20250910123401.175403-1-petrm@nvidia.com> (raw)

Two forms of upstream commit references are used (and documented) for
stable kernels:

- [ Upstream commit <sha1> ]
- commit <sha1> upstream.

Extend checkpatch so that it doesn't cite these. This reduces noise that
downstream maintainers experience when checkpatching patches that may
contain commit references of this sort.

In order to future-proof the script, allow also permutations of the above
styles: with a period or without, bracketed or not, capitalized or not. The
hash is recognized as at least 7 digits long, similarly to the "This
reverts commit" exclude below.

Signed-off-by: Petr Machata <petrm@nvidia.com>
---

Notes:
    v5:
    - No changes, just a ping.
    
    v4:
    - No changes, just a ping.
    
    v3:
    - Tolerate a couple more upstream commit reference styles.
    
    v2:
    - No changes, just a ping.

 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e722dd6fa8ef..53b21b4a4760 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3352,6 +3352,8 @@ sub process {
 		if ($perl_version_ok &&
 		    $in_commit_log && !$commit_log_possible_stack_dump &&
 		    $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
+		    $line !~ /^(\[\s*)?[Uu]pstream commit [0-9a-f]{7,40}\.?(\s*])?/ &&
+		    $line !~ /^(\[\s*)?[Cc]ommit\s*[0-9a-f]{7,40}\s*upstream\.?(\s*])?/ &&
 		    $line !~ /^This reverts commit [0-9a-f]{7,40}/ &&
 		    (($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
 		      ($line =~ /\bcommit\s*$/i && defined($rawlines[$linenr]) && $rawlines[$linenr] =~ /^\s*[0-9a-f]{5,}\b/i)) ||
-- 
2.49.0


                 reply	other threads:[~2025-09-10 12:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250910123401.175403-1-petrm@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=apw@canonical.com \
    --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