Commit 870020f93af2323a81f179091a0780dc1d5b916b

Authored by Joe Perches
Committed by Linus Torvalds
1 parent 82c4dfc762

scripts/get_maintainer.pl: Add -f directory use

Don't require a specific file in a directory to be tested.

Also Arnd Bergmann pointed out that the MAINTAINERS pattern requirement
that directory patterns have a trailing slash was unnecessary and was
likely to be error prone.  Removed that requirement.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 19 additions and 4 deletions Side-by-side Diff

scripts/get_maintainer.pl
... ... @@ -13,7 +13,7 @@
13 13 use strict;
14 14  
15 15 my $P = $0;
16   -my $V = '0.16';
  16 +my $V = '0.17';
17 17  
18 18 use Getopt::Long qw(:config no_auto_abbrev);
19 19  
... ... @@ -132,6 +132,10 @@
132 132 $value =~ s@\.@\\\.@g; ##Convert . to \.
133 133 $value =~ s/\*/\.\*/g; ##Convert * to .*
134 134 $value =~ s/\?/\./g; ##Convert ? to .
  135 + ##if pattern is a directory and it lacks a trailing slash, add one
  136 + if ((-d $value)) {
  137 + $value =~ s@([^/])$@$1/@;
  138 + }
135 139 }
136 140 push(@typevalue, "$type:$value");
137 141 } elsif (!/^(\s)*$/) {
... ... @@ -146,8 +150,10 @@
146 150 my @files = ();
147 151  
148 152 foreach my $file (@ARGV) {
149   - next if ((-d $file));
150   - if (!(-f $file)) {
  153 + ##if $file is a directory and it lacks a trailing slash, add one
  154 + if ((-d $file)) {
  155 + $file =~ s@([^/])$@$1/@;
  156 + } elsif (!(-f $file)) {
151 157 die "$P: file '${file}' not found\n";
152 158 }
153 159 if ($from_filename) {
... ... @@ -292,7 +298,7 @@
292 298 sub usage {
293 299 print <<EOT;
294 300 usage: $P [options] patchfile
295   - $P [options] -f file
  301 + $P [options] -f file|directory
296 302 version: $V
297 303  
298 304 MAINTAINER field selection options:
... ... @@ -322,6 +328,15 @@
322 328 --version => show version
323 329 --help => show this help information
324 330  
  331 +Notes:
  332 + Using "-f directory" may give unexpected results:
  333 +
  334 + Used with "--git", git signators for _all_ files in and below
  335 + directory are examined as git recurses directories.
  336 + Any specified X: (exclude) pattern matches are _not_ ignored.
  337 + Used with "--nogit", directory is used as a pattern match,
  338 + no individual file within the directory or subdirectory
  339 + is matched.
325 340 EOT
326 341 }
327 342