Re: [PATCH] checkpatch: relax check for revert commit

From: Jia He
Date: Mon Apr 09 2018 - 22:43:07 EST




On 4/9/2018 6:50 PM, Joe Perches Wrote:
On Mon, 2018-04-09 at 14:37 +0800, Jia He wrote:
On 4/9/2018 1:07 AM, Joe Perches Wrote:
On Sun, 2018-04-08 at 10:12 +0800, Jia He wrote:
Hi Andy & Joe

Although it is minor, it is a real bug, I thought.

Is there any comment? Thank you
If you really want to do something useful here,
quote the quote characters and compare for that.


Hi Joe, thanks for the comments
I am not sure I understand you comments here.
Change the tests to allow quote characters instead
of ignoring them.

To do this matching, any internal quote character in
the actual commit string and the commit string from the
patch must be perl quoted with \Q<string>\E so that the
expected title can be matched properly.
Sorry,I didn't catch your point, even can't image how \Q \E is helpful. ;-)
Maybe I haven't explained my changes clearly.
e.g. commit f5c1350256fb ("Revert "XXX"")
2617ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i &&
2618ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ defined $rawlines[$linenr] &&
2619ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) {
2620ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ $orig_desc = $1;
2621ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ $hasparens = 1;
line 2619, the match pattern ([^"]+)"\) will match NULL and let $orig_desc="" in this case.
My change is to let $orig_desc to be Revert "XXX"
Since the old code will check the commit id by git command to get the _real_ commit title.
I can't understand why I should use \Q \E here, sorry if I am missing something.

Cheers,
Jia