[RFC PATCH 1/5] checkpatch: improve handling of revert commits

From: Denis Efremov
Date: Wed Aug 18 2021 - 11:47:32 EST


Properly handle commits like:
commit f2791e7eadf4 ("Revert "floppy: refactor open() flags handling"")

Cc: Joe Perches <joe@xxxxxxxxxxx>
Signed-off-by: Denis Efremov <efremov@xxxxxxxxx>
---
scripts/checkpatch.pl | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 461d4221e4a4..cf31e8c994d3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3200,20 +3200,20 @@ sub process {
$long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i);
$space = 0 if ($line =~ /\bcommit [0-9a-f]/i);
$case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/);
- if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) {
+ if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("(.+)"\)/i) {
$orig_desc = $1;
$hasparens = 1;
} elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i &&
defined $rawlines[$linenr] &&
- $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) {
+ $rawlines[$linenr] =~ /^\s*\("(.+)"\)/) {
$orig_desc = $1;
$hasparens = 1;
- } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i &&
+ } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\(".+$/i &&
defined $rawlines[$linenr] &&
- $rawlines[$linenr] =~ /^\s*[^"]+"\)/) {
- $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i;
+ $rawlines[$linenr] =~ /^\s*.+"\)/) {
+ $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("(.+)$/i;
$orig_desc = $1;
- $rawlines[$linenr] =~ /^\s*([^"]+)"\)/;
+ $rawlines[$linenr] =~ /^\s*(.+)"\)/;
$orig_desc .= " " . $1;
$hasparens = 1;
}
--
2.31.1