Skip to content

Commit

Permalink
get_maintainer.pl: allow "K:" pattern tests to match non-patch text
Browse files Browse the repository at this point in the history
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 <[email protected]>
Original-patch-by: L. Alberto Giménez <[email protected]>
Acked-by: L. Alberto Giménez <[email protected]>

Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoePerches authored and torvalds committed Mar 23, 2011
1 parent 5af5bcb commit 7764dcb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scripts/get_maintainer.pl
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,14 @@ sub read_mailmap {

open(my $patch, "< $file")
or die "$P: Can't open $file: $!\n";

# We can check arbitrary information before the patch
# like the commit message, mail headers, etc...
# This allows us to match arbitrary keywords against any part
# of a git format-patch generated file (subject tags, etc...)

my $patch_prefix = ""; #Parsing the intro

while (<$patch>) {
my $patch_line = $_;
if (m/^\+\+\+\s+(\S+)/) {
Expand All @@ -428,13 +436,14 @@ sub read_mailmap {
$filename =~ s@\n@@;
$lastfile = $filename;
push(@files, $filename);
$patch_prefix = "^[+-].*"; #Now parsing the actual patch
} elsif (m/^\@\@ -(\d+),(\d+)/) {
if ($email_git_blame) {
push(@range, "$lastfile:$1:$2");
}
} elsif ($keywords) {
foreach my $line (keys %keyword_hash) {
if ($patch_line =~ m/^[+-].*$keyword_hash{$line}/x) {
if ($patch_line =~ m/${patch_prefix}$keyword_hash{$line}/x) {
push(@keyword_tvi, $line);
}
}
Expand Down

0 comments on commit 7764dcb

Please sign in to comment.