checkpatch: extend unknown commit id check for multiple lines
RFC PATCH 1/1 checkpatch: extend unknown commit id check for multiple lines
The check for unknown commit id cannot process commit references split across multiple lines such as:
... via commit3945ff37d2f4 ("linux/bits.h: Extract common header for vDSO").
Extend the check to handle the above.
Signed-off-by Dwaipayan Ray <[email protected]>
--- scripts/checkpatch.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +6 -3
@@ -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); } }
Signature · 1 line
2.28.0