diff options
author | Joe Perches <joe@perches.com> | 2011-03-22 19:34:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:44:13 -0400 |
commit | 7764dcb53473e5665ab3cdc461ccfc510fce925e (patch) | |
tree | e839911d1d15cbd066477b13dfeea2e3f2ff1446 | |
parent | 5af5bcb8d37f99ba415a1adc6da71051b84f93a5 (diff) |
get_maintainer.pl: allow "K:" pattern tests to match non-patch text
Extend the usage of the K section in the MAINTAINERS file to support
matching regular expressions to any arbitrary text that may precede the
patch itself. For example, the commit message or mail headers generated
by git-format-patch.
Signed-off-by: Joe Perches <joe@perches.com>
Original-patch-by: L. Alberto Giménez <agimenez@sysvalve.es>
Acked-by: L. Alberto Giménez <agimenez@sysvalve.es>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rwxr-xr-x | scripts/get_maintainer.pl | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 139e0fff8e31..d29a8d75cb22 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -420,6 +420,14 @@ foreach my $file (@ARGV) { | |||
420 | 420 | ||
421 | open(my $patch, "< $file") | 421 | open(my $patch, "< $file") |
422 | or die "$P: Can't open $file: $!\n"; | 422 | or die "$P: Can't open $file: $!\n"; |
423 | |||
424 | # We can check arbitrary information before the patch | ||
425 | # like the commit message, mail headers, etc... | ||
426 | # This allows us to match arbitrary keywords against any part | ||
427 | # of a git format-patch generated file (subject tags, etc...) | ||
428 | |||
429 | my $patch_prefix = ""; #Parsing the intro | ||
430 | |||
423 | while (<$patch>) { | 431 | while (<$patch>) { |
424 | my $patch_line = $_; | 432 | my $patch_line = $_; |
425 | if (m/^\+\+\+\s+(\S+)/) { | 433 | if (m/^\+\+\+\s+(\S+)/) { |
@@ -428,13 +436,14 @@ foreach my $file (@ARGV) { | |||
428 | $filename =~ s@\n@@; | 436 | $filename =~ s@\n@@; |
429 | $lastfile = $filename; | 437 | $lastfile = $filename; |
430 | push(@files, $filename); | 438 | push(@files, $filename); |
439 | $patch_prefix = "^[+-].*"; #Now parsing the actual patch | ||
431 | } elsif (m/^\@\@ -(\d+),(\d+)/) { | 440 | } elsif (m/^\@\@ -(\d+),(\d+)/) { |
432 | if ($email_git_blame) { | 441 | if ($email_git_blame) { |
433 | push(@range, "$lastfile:$1:$2"); | 442 | push(@range, "$lastfile:$1:$2"); |
434 | } | 443 | } |
435 | } elsif ($keywords) { | 444 | } elsif ($keywords) { |
436 | foreach my $line (keys %keyword_hash) { | 445 | foreach my $line (keys %keyword_hash) { |
437 | if ($patch_line =~ m/^[+-].*$keyword_hash{$line}/x) { | 446 | if ($patch_line =~ m/${patch_prefix}$keyword_hash{$line}/x) { |
438 | push(@keyword_tvi, $line); | 447 | push(@keyword_tvi, $line); |
439 | } | 448 | } |
440 | } | 449 | } |