Skip to content

Commit 7764dcb

Browse files
JoePerchestorvalds
authored andcommitted
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>
1 parent 5af5bcb commit 7764dcb

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎scripts/get_maintainer.pl‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,14 @@ sub read_mailmap {
420420

421421
open(my $patch, "< $file")
422422
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+
423431
while (<$patch>) {
424432
my $patch_line = $_;
425433
if (m/^\+\+\+\s+(\S+)/) {
@@ -428,13 +436,14 @@ sub read_mailmap {
428436
$filename =~ s@\n@@;
429437
$lastfile = $filename;
430438
push(@files, $filename);
439+
$patch_prefix = "^[+-].*"; #Now parsing the actual patch
431440
} elsif (m/^\@\@ -(\d+),(\d+)/) {
432441
if ($email_git_blame) {
433442
push(@range, "$lastfile:$1:$2");
434443
}
435444
} elsif ($keywords) {
436445
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) {
438447
push(@keyword_tvi, $line);
439448
}
440449
}

0 commit comments

Comments
 (0)