[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3d347d4b-1576-754f-8633-ba6084cc0661@linux.com>
Date: Wed, 18 Aug 2021 19:21:19 +0300
From: Denis Efremov <efremov@...ux.com>
To: Joe Perches <joe@...ches.com>, linux-kselftest@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, linux-block@...r.kernel.org,
Jens Axboe <axboe@...nel.dk>, Jiri Kosina <jkosina@...e.cz>,
Willy Tarreau <w@....eu>
Subject: Re: [RFC PATCH 1/5] checkpatch: improve handling of revert commits
On 8/18/21 7:00 PM, Joe Perches wrote:
> On Wed, 2021-08-18 at 18:46 +0300, Denis Efremov wrote:
>> Properly handle commits like:
>> commit f2791e7eadf4 ("Revert "floppy: refactor open() flags handling"")
>
> Try this one:
>
> https://lore.kernel.org/lkml/7f55d9d0369f1ea840fab83eeb77f9f3601fee41.camel@perches.com/
>
It works but why not to use .+? then?
I'm not sure that non-greedy patterns will properly handle commits like:
$ git log --oneline | fgrep '")'
e.g.
commit ece2619fe8ed ("extcon: arizona: Fix flags parameter to the gpiod_get("wlf,micd-pol") call")
>>
>> Cc: Joe Perches <joe@...ches.com>
>> Signed-off-by: Denis Efremov <efremov@...ux.com>
>> ---
>> 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;
>> }
>
Powered by blists - more mailing lists