* [PATCH] checkpatch: Yet another commit id improvement
@ 2016-07-18 19:27 Joe Perches
2016-07-19 9:51 ` Andy Whitcroft
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2016-07-18 19:27 UTC (permalink / raw)
To: Andrew Morton, Andy Whitcroft; +Cc: Zhuo, Qiuxu, linux-kernel
Using \b isn't good enough to isolate what appears to be a
commit id in a commit message.
Make sure there is a space or a quote like character after
a continuous run of hexadecimal characters that could be
a commit id.
Signed-off-by: Joe Perches <joe@perches.com>
cc: "Zhuo, Qiuxu" <qiuxu.zhuo@intel.com>
---
scripts/checkpatch.pl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a0e5112..8209ae5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2460,9 +2460,9 @@ sub process {
# Check for git id commit length and improperly formed commit descriptions
if ($in_commit_log && !$commit_log_possible_stack_dump &&
- $line !~ /^\s*(?:Link|Patchwork|http|BugLink):/i &&
+ $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink):/i &&
($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
- ($line =~ /\b[0-9a-f]{12,40}\b/i &&
+ ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
$line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i &&
$line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
my $init_char = "c";
--
2.8.0.rc4.16.g56331f8
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch: Yet another commit id improvement
2016-07-18 19:27 [PATCH] checkpatch: Yet another commit id improvement Joe Perches
@ 2016-07-19 9:51 ` Andy Whitcroft
2016-07-19 10:05 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Andy Whitcroft @ 2016-07-19 9:51 UTC (permalink / raw)
To: Joe Perches; +Cc: Andrew Morton, Zhuo, Qiuxu, linux-kernel
On Mon, Jul 18, 2016 at 12:27:42PM -0700, Joe Perches wrote:
> Using \b isn't good enough to isolate what appears to be a
> commit id in a commit message.
>
> Make sure there is a space or a quote like character after
> a continuous run of hexadecimal characters that could be
> a commit id.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> cc: "Zhuo, Qiuxu" <qiuxu.zhuo@intel.com>
> ---
> scripts/checkpatch.pl | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index a0e5112..8209ae5 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2460,9 +2460,9 @@ sub process {
>
> # Check for git id commit length and improperly formed commit descriptions
> if ($in_commit_log && !$commit_log_possible_stack_dump &&
> - $line !~ /^\s*(?:Link|Patchwork|http|BugLink):/i &&
> + $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink):/i &&
> ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
> - ($line =~ /\b[0-9a-f]{12,40}\b/i &&
> + ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
If we expect a quote after would it be unreasonable to allow then at the
beginning too?
> $line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i &&
> $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
> my $init_char = "c";
-apw
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch: Yet another commit id improvement
2016-07-19 9:51 ` Andy Whitcroft
@ 2016-07-19 10:05 ` Joe Perches
2016-07-21 12:27 ` Andy Whitcroft
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2016-07-19 10:05 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: Andrew Morton, Zhuo, Qiuxu, linux-kernel
On Tue, 2016-07-19 at 10:51 +0100, Andy Whitcroft wrote:
> On Mon, Jul 18, 2016 at 12:27:42PM -0700, Joe Perches wrote:
> >
> > Using \b isn't good enough to isolate what appears to be a
> > commit id in a commit message.
> >
> > Make sure there is a space or a quote like character after
> > a continuous run of hexadecimal characters that could be
> > a commit id.
[]
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> > @@ -2460,9 +2460,9 @@ sub process {
> >
> > # Check for git id commit length and improperly formed commit descriptions
> > if ($in_commit_log && !$commit_log_possible_stack_dump &&
> > - $line !~ /^\s*(?:Link|Patchwork|http|BugLink):/i &&
> > + $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink):/i &&
> > ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
> > - ($line =~ /\b[0-9a-f]{12,40}\b/i &&
> > + ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
> If we expect a quote after would it be unreasonable to allow then at the
> beginning too?
Perhaps not. The idea is the quote starts the commit description
not ends the commit SHA-1 hash.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch: Yet another commit id improvement
2016-07-19 10:05 ` Joe Perches
@ 2016-07-21 12:27 ` Andy Whitcroft
0 siblings, 0 replies; 4+ messages in thread
From: Andy Whitcroft @ 2016-07-21 12:27 UTC (permalink / raw)
To: Joe Perches; +Cc: Andrew Morton, Zhuo, Qiuxu, linux-kernel
On Tue, Jul 19, 2016 at 03:05:56AM -0700, Joe Perches wrote:
> On Tue, 2016-07-19 at 10:51 +0100, Andy Whitcroft wrote:
> > On Mon, Jul 18, 2016 at 12:27:42PM -0700, Joe Perches wrote:
> > >
> > > Using \b isn't good enough to isolate what appears to be a
> > > commit id in a commit message.
> > >
> > > Make sure there is a space or a quote like character after
> > > a continuous run of hexadecimal characters that could be
> > > a commit id.
> []
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > > @@ -2460,9 +2460,9 @@ sub process {
> > >
> > > # Check for git id commit length and improperly formed commit descriptions
> > > if ($in_commit_log && !$commit_log_possible_stack_dump &&
> > > - $line !~ /^\s*(?:Link|Patchwork|http|BugLink):/i &&
> > > + $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink):/i &&
> > > ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
> > > - ($line =~ /\b[0-9a-f]{12,40}\b/i &&
> > > + ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
> > If we expect a quote after would it be unreasonable to allow then at the
> > beginning too?
>
> Perhaps not. The idea is the quote starts the commit description
> not ends the commit SHA-1 hash.
Then carry on as before. Looks fine.
-apw
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-21 12:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-18 19:27 [PATCH] checkpatch: Yet another commit id improvement Joe Perches
2016-07-19 9:51 ` Andy Whitcroft
2016-07-19 10:05 ` Joe Perches
2016-07-21 12:27 ` Andy Whitcroft
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox