public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dwaipayan Ray <dwaipayanray1@gmail.com>
To: joe@perches.com
Cc: lukas.bulwahn@gmail.com, linux-kernel@vger.kernel.org,
	Dwaipayan Ray <dwaipayanray1@gmail.com>
Subject: [PATCH RFC] checkpatch: extend unknown commit id check for multiple lines
Date: Sun, 20 Jun 2021 22:38:01 +0530	[thread overview]
Message-ID: <20210620170801.12940-1-dwaipayanray1@gmail.com> (raw)

The check for unknown commit id cannot process commit references
split across multiple lines such as:

... via commit
3945ff37d2f4 ("linux/bits.h: Extract common header for vDSO").

Extend the check to handle the above.

Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
---
 scripts/checkpatch.pl | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 0eb73e59e0b5..8d19beca3538 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3335,13 +3335,16 @@ sub process {
 		}
 
 # check for invalid commit id
-		if ($in_commit_log && $line =~ /(^fixes:|\bcommit)\s+([0-9a-f]{6,40})\b/i) {
+		if ($in_commit_log &&
+		    ($line =~ /(?:^fixes:|\bcommit)\s+([0-9a-f]{6,40})\b/i ||
+		     ($lines[$linenr - 2] =~ /\bcommit\s*$/i &&
+		      $line =~ /^\s*([0-9a-f]{6,40})\b/i))) {
 			my $id;
 			my $description;
-			($id, $description) = git_commit_info($2, undef, undef);
+			($id, $description) = git_commit_info($1, undef, undef);
 			if (!defined($id)) {
 				WARN("UNKNOWN_COMMIT_ID",
-				     "Unknown commit id '$2', maybe rebased or not pulled?\n" . $herecurr);
+				     "Unknown commit id '$1', maybe rebased or not pulled?\n" . $herecurr);
 			}
 		}
 
-- 
2.28.0


                 reply	other threads:[~2021-06-20 17:11 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=20210620170801.12940-1-dwaipayanray1@gmail.com \
    --to=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