All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] checkpatch: support "base-commit:" format
@ 2020-02-12 23:32 John Hubbard
  2020-02-12 23:32 ` [PATCH 1/1] " John Hubbard
  0 siblings, 1 reply; 5+ messages in thread
From: John Hubbard @ 2020-02-12 23:32 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andy Whitcroft, Jonathan Corbet, Konstantin Ryabitsev, LKML,
	John Hubbard

In order to support the get-lore-mbox.py tool described in [1], I ran:

    git format-patch --base=<commit> --cover-letter <revrange>

...which generated a "base-commit: <commit-hash>" tag at the end of the
cover letter, just like you can see at the end of this cover letter.
However, checkpatch.pl generated an error upon encounting
"base-commit:" in the cover letter.

So, I suspect that no one is actually using the --base option yet, but
if [1] leads to get-lore-mbox.py and similar scripts becoming popular,
then we'll want checkpatch.pl to work well with them. This tiny patch
does that.

An alternative approach to fixing this would be to make the --base
option emit a checkpatch-friendly commit style. However, I think that's
much less desirable, because base-commit is really just for tools
(mainly "git am") to consume. And so we don't really want it to take up
any more valuable lines in the commit letter than it already does.

thanks,
John Hubbard
NVIDIA


John Hubbard (1):
  checkpatch: support "base-commit:" format

 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)


base-commit: 0bf999f9c5e74c7ecf9dafb527146601e5c848b9
-- 
2.25.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] checkpatch: support "base-commit:" format
  2020-02-12 23:32 [PATCH 0/1] checkpatch: support "base-commit:" format John Hubbard
@ 2020-02-12 23:32 ` John Hubbard
  2020-02-13  1:06   ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: John Hubbard @ 2020-02-12 23:32 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andy Whitcroft, Jonathan Corbet, Konstantin Ryabitsev, LKML,
	John Hubbard

In order to support the get-lore-mbox.py tool described in [1], I ran:

    git format-patch --base=<commit> --cover-letter <revrange>

...which generated a "base-commit: <commit-hash>" tag at the end of the
cover letter. However, checkpatch.pl generated an error upon encounting
"base-commit:" in the cover letter:

    "ERROR: Please use git commit description style..."

...because it found the "commit" keyword, and failed to recognize that
it was part of the "base-commit" phrase, and as such, should not be
subjected to the same commit description style rules.

Update checkpatch.pl to include a special case for "base-commit:", so
that that tag no longer generates a checkpatch error.

[1] https://lwn.net/Articles/811528/ "Better tools for kernel
    developers"

Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a63380c6b0d2..f241865cedb3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2761,6 +2761,7 @@ sub process {
 
 # Check for git id commit length and improperly formed commit descriptions
 		if ($in_commit_log && !$commit_log_possible_stack_dump &&
+		    $line !~ /base-commit:/ &&
 		    $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink):/i &&
 		    $line !~ /^This reverts commit [0-9a-f]{7,40}/ &&
 		    ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] checkpatch: support "base-commit:" format
  2020-02-12 23:32 ` [PATCH 1/1] " John Hubbard
@ 2020-02-13  1:06   ` Joe Perches
  2020-02-13  1:32     ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2020-02-13  1:06 UTC (permalink / raw)
  To: John Hubbard; +Cc: Andy Whitcroft, Jonathan Corbet, Konstantin Ryabitsev, LKML

On Wed, 2020-02-12 at 15:32 -0800, John Hubbard wrote:
> In order to support the get-lore-mbox.py tool described in [1], I ran:
> 
>     git format-patch --base=<commit> --cover-letter <revrange>
> 
> ...which generated a "base-commit: <commit-hash>" tag at the end of the
> cover letter. However, checkpatch.pl generated an error upon encounting
> "base-commit:" in the cover letter:
> 
>     "ERROR: Please use git commit description style..."
> 
> ...because it found the "commit" keyword, and failed to recognize that
> it was part of the "base-commit" phrase, and as such, should not be
> subjected to the same commit description style rules.
> 
> Update checkpatch.pl to include a special case for "base-commit:", so
> that that tag no longer generates a checkpatch error.
> 
> [1] https://lwn.net/Articles/811528/ "Better tools for kernel
>     developers"
> 
> Cc: Andy Whitcroft <apw@canonical.com>
> Cc: Joe Perches <joe@perches.com>
> Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> ---
>  scripts/checkpatch.pl | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index a63380c6b0d2..f241865cedb3 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2761,6 +2761,7 @@ sub process {
>  
>  # Check for git id commit length and improperly formed commit descriptions
>  		if ($in_commit_log && !$commit_log_possible_stack_dump &&
> +		    $line !~ /base-commit:/ &&

If this base-commit: entry is only at the start of line,
I presume this should actually be

		    $line !~ /^base-commit:/ &&
or maybe
		    $line !~ /^\s*base-commit:/ &&

>  		    $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink):/i &&
>  		    $line !~ /^This reverts commit [0-9a-f]{7,40}/ &&
>  		    ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] checkpatch: support "base-commit:" format
  2020-02-13  1:06   ` Joe Perches
@ 2020-02-13  1:32     ` Joe Perches
  2020-02-13  4:22       ` John Hubbard
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2020-02-13  1:32 UTC (permalink / raw)
  To: John Hubbard; +Cc: Andy Whitcroft, Jonathan Corbet, Konstantin Ryabitsev, LKML

On Wed, 2020-02-12 at 17:06 -0800, Joe Perches wrote:
> On Wed, 2020-02-12 at 15:32 -0800, John Hubbard wrote:
> > In order to support the get-lore-mbox.py tool described in [1], I ran:
> > 
> >     git format-patch --base=<commit> --cover-letter <revrange>
> > 
> > ...which generated a "base-commit: <commit-hash>" tag at the end of the
> > cover letter. However, checkpatch.pl generated an error upon encounting
> > "base-commit:" in the cover letter:
> > 
> >     "ERROR: Please use git commit description style..."
> > 
> > ...because it found the "commit" keyword, and failed to recognize that
> > it was part of the "base-commit" phrase, and as such, should not be
> > subjected to the same commit description style rules.
> > 
> > Update checkpatch.pl to include a special case for "base-commit:", so
> > that that tag no longer generates a checkpatch error.
[]
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> > @@ -2761,6 +2761,7 @@ sub process {
> >  
> >  # Check for git id commit length and improperly formed commit descriptions
> >  		if ($in_commit_log && !$commit_log_possible_stack_dump &&
> > +		    $line !~ /base-commit:/ &&
> 
> If this base-commit: entry is only at the start of line,
> I presume this should actually be
> 
> 		    $line !~ /^base-commit:/ &&
> or maybe
> 		    $line !~ /^\s*base-commit:/ &&
> 
> >  		    $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink):/i &&

and probably better to just add it to this line instead like

 		    $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] checkpatch: support "base-commit:" format
  2020-02-13  1:32     ` Joe Perches
@ 2020-02-13  4:22       ` John Hubbard
  0 siblings, 0 replies; 5+ messages in thread
From: John Hubbard @ 2020-02-13  4:22 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andy Whitcroft, Jonathan Corbet, Konstantin Ryabitsev, LKML

On 2/12/20 5:32 PM, Joe Perches wrote:
> On Wed, 2020-02-12 at 17:06 -0800, Joe Perches wrote:
>> On Wed, 2020-02-12 at 15:32 -0800, John Hubbard wrote:
>>> In order to support the get-lore-mbox.py tool described in [1], I ran:
>>>
>>>      git format-patch --base=<commit> --cover-letter <revrange>
>>>
>>> ...which generated a "base-commit: <commit-hash>" tag at the end of the
>>> cover letter. However, checkpatch.pl generated an error upon encounting
>>> "base-commit:" in the cover letter:
>>>
>>>      "ERROR: Please use git commit description style..."
>>>
>>> ...because it found the "commit" keyword, and failed to recognize that
>>> it was part of the "base-commit" phrase, and as such, should not be
>>> subjected to the same commit description style rules.
>>>
>>> Update checkpatch.pl to include a special case for "base-commit:", so
>>> that that tag no longer generates a checkpatch error.
> []
>>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
>>> @@ -2761,6 +2761,7 @@ sub process {
>>>   
>>>   # Check for git id commit length and improperly formed commit descriptions
>>>   		if ($in_commit_log && !$commit_log_possible_stack_dump &&
>>> +		    $line !~ /base-commit:/ &&
>>
>> If this base-commit: entry is only at the start of line,


As far as I can tell, we should be able to rely on that, yes.


>> I presume this should actually be
>>
>> 		    $line !~ /^base-commit:/ &&
>> or maybe
>> 		    $line !~ /^\s*base-commit:/ &&
>>
>>>   		    $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink):/i &&
> 
> and probably better to just add it to this line instead like
> 
>   		    $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
>  

Yes, that looks nice. I'll send a v2 doing it that way.


thanks,
-- 
John Hubbard
NVIDIA

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-13  4:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-12 23:32 [PATCH 0/1] checkpatch: support "base-commit:" format John Hubbard
2020-02-12 23:32 ` [PATCH 1/1] " John Hubbard
2020-02-13  1:06   ` Joe Perches
2020-02-13  1:32     ` Joe Perches
2020-02-13  4:22       ` John Hubbard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.