Subject: Re: [PATCH] scripts: checkpatch: steer people away from using file paths

From: Jakub Kicinski <[email-masked]>
Date: Tue, 25 Jul 2023 15:15:52 -0700

On Tue, 25 Jul 2023 14:18:15 -0700 Joe Perches wrote:
> > @@ -544,7 +546,13 @@ foreach my $file (@ARGV) {
> >      if ($from_filename && (vcs_exists() && !vcs_file_exists($file))) {
> >  	warn "$P: file '$file' not found in version control $!\n";
> >      }
> > -    if ($from_filename || ($file ne "&STDIN" && vcs_file_exists($file))) {
> > +    if ($from_filename) {
> > +	if (!$silence_file_warning) {
> > +	    warn "$P: WARNING: Prefer running the script on patches as "
> > +	        . "generated by git format-patch. Selecting paths is known "
> > +		. "to miss recipients!\n";  
> 
> Don't separate a single output message into multiple lines.
> Coalesce the string elements.
> 
> Also, this should show some reason why this isn't appropriate
> as a patch to a single file would not have this issue.
> 
> e.g.:	When a patch series touches multiple files, showing all maintainers is useful. see:  <some process doc>

I tried to do that in --help. Added the "multiple files" one there, too.

> > @@ -1089,6 +1098,10 @@ version: $V
> >     --pattern-depth=0 --remove-duplicates --rolestats]
> >  
> >  Notes:
> > +  Using "-f file" is generally discouraged, running the script on a filepatch
> > +      (as generated by git format-patch) is usually the right thing to do.
> > +      Commit message is an integral part of the change and $P
> > +      will extract additional information from it (keywords, Fixes tags etc.)  
> 
> "filepatch" doesn't appear in the kernel at all. Use "patch file".

I got it the wrong way around. I'll use patchfile (no space) for v2
since that's what's what get_maintainer uses in two other places.