Skip to contentSkip to conversation

checkpatch: support "base-commit:" format

PATCH Superseded John Hubbard 2 participants 5 messages Feb 12, 2020 – Feb 13, 2020 Checkpatch

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover checkpatch: support "base-commit:" format

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

Signature · 1 line
2.25.0
#1 lore raw

PATCH 1/1 checkpatch: support "base-commit:" format

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 <[email protected]>
Cc Joe Perches <[email protected]>
Cc Konstantin Ryabitsev <[email protected]>
Cc Jonathan Corbet <[email protected]>
---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)
scripts/checkpatch.pl +1 -0
index a63380c6b0d2..f241865cedb3 100755
@@ -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 ||
Signature · 1 line
2.25.0
maintainer
#2 lore raw
Quoted 34 lines · 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 <[email protected]>
Cc Joe Perches <[email protected]>
Cc Konstantin Ryabitsev <[email protected]>
Cc Jonathan Corbet <[email protected]>
---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)
scripts/checkpatch.pl +0 -0
index a63380c6b0d2..f241865cedb3 100755

scripts/checkpatch.pl sub process { · line 2764

Quoted 4 lines
scripts/checkpatch.pl +1 -0
@@ -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:/ &&
Quoted 3 lines
scripts/checkpatch.pl +0 -0
 		    $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 ||
maintainer
#3 lore raw
Quoted 9 lines · Joe Perches
Quoted 8 lines · 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:

Quoted 8 lines
Quoted 8 lines

"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.

[]

Quoted 1 line

scripts/checkpatch.pl

Quoted 1 line
scripts/checkpatch.pl +0 -0

[]

Quoted 9 lines

scripts/checkpatch.pl sub process { · line 2764

Quoted 5 lines
scripts/checkpatch.pl +1 -0
@@ -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

Quoted 5 lines
		    $line !~ /^base-commit:/ &&
or maybe
		    $line !~ /^\s*base-commit:/ &&
Quoted 1 line
scripts/checkpatch.pl +0 -0
 		    $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 &&

#4 lore raw
Quoted 16 lines · Joe Perches
Quoted 15 lines · Joe Perches
Quoted 14 lines · 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.

Quoted 12 lines
Quoted 2 lines
Quoted 2 lines

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

[]

Quoted 1 line

scripts/checkpatch.pl

Quoted 1 line
scripts/checkpatch.pl +0 -0

[]

Quoted 7 lines

scripts/checkpatch.pl sub process { · line 2764

Quoted 5 lines
scripts/checkpatch.pl +1 -0
@@ -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.

Quoted 6 lines
Quoted 6 lines

I presume this should actually be

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

scripts/checkpatch.pl sub process { · line 2765

Quoted 1 line
scripts/checkpatch.pl +0 -0
  		    $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,

Signature · 2 lines
John Hubbard
NVIDIA