Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

get_maintainer: add ** glob pattern support

Add support for the ** glob operator in MAINTAINERS F: and X: patterns,
matching any number of path components (like Python's ** glob).

The existing * to .* conversion with slash-count check is preserved. **
is converted to (?:.*), a non-capturing group used as a marker to bypass
the slash-count check in file_match_pattern(), allowing the pattern to
cross directory boundaries.

This enables patterns like F: **/*[_-]kunit*.c to match files at any depth
in the tree.

Link: https://lkml.kernel.org/r/20260302103822.77343-1-teknoraver@meta.com
Signed-off-by: Matteo Croce <teknoraver@meta.com>
Acked-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matteo Croce and committed by
Andrew Morton
42084933 defec2ca

+8 -2
+1
MAINTAINERS
··· 35 35 F: drivers/net/ all files in and below drivers/net 36 36 F: drivers/net/* all files in drivers/net, but not below 37 37 F: */net/* all files in "any top level directory"/net 38 + F: fs/**/*foo*.c all *foo*.c files in any subdirectory of fs 38 39 One pattern per line. Multiple F: lines acceptable. 39 40 X: *Excluded* files and directories that are NOT maintained, same 40 41 rules as F:. Files exclusions are tested before file matches.
+7 -2
scripts/get_maintainer.pl
··· 375 375 ##Filename pattern matching 376 376 if ($type eq "F" || $type eq "X") { 377 377 $value =~ s@\.@\\\.@g; ##Convert . to \. 378 + $value =~ s/\*\*/\x00/g; ##Convert ** to placeholder 378 379 $value =~ s/\*/\.\*/g; ##Convert * to .* 379 380 $value =~ s/\?/\./g; ##Convert ? to . 381 + $value =~ s/\x00/(?:.*)/g; ##Convert placeholder to (?:.*) 380 382 ##if pattern is a directory and it lacks a trailing slash, add one 381 383 if ((-d $value)) { 382 384 $value =~ s@([^/])$@$1/@; ··· 748 746 if (($type eq "F" || $type eq "X") && 749 747 ($self_test eq "" || $self_test =~ /\bpatterns\b/)) { 750 748 $value =~ s@\.@\\\.@g; ##Convert . to \. 749 + $value =~ s/\*\*/\x00/g; ##Convert ** to placeholder 751 750 $value =~ s/\*/\.\*/g; ##Convert * to .* 752 751 $value =~ s/\?/\./g; ##Convert ? to . 752 + $value =~ s/\x00/(?:.*)/g; ##Convert placeholder to (?:.*) 753 753 ##if pattern is a directory and it lacks a trailing slash, add one 754 754 if ((-d $value)) { 755 755 $value =~ s@([^/])$@$1/@; ··· 925 921 my $value_pd = ($value =~ tr@/@@); 926 922 my $file_pd = ($file =~ tr@/@@); 927 923 $value_pd++ if (substr($value,-1,1) ne "/"); 928 - $value_pd = -1 if ($value =~ /^\.\*/); 924 + $value_pd = -1 if ($value =~ /^(\.\*|\(\?:\.\*\))/); 929 925 if ($value_pd >= $file_pd && 930 926 range_is_maintained($start, $end) && 931 927 range_has_maintainer($start, $end)) { ··· 959 955 $line =~ s/([^\\])\.([^\*])/$1\?$2/g; 960 956 $line =~ s/([^\\])\.$/$1\?/g; ##Convert . back to ? 961 957 $line =~ s/\\\./\./g; ##Convert \. to . 958 + $line =~ s/\(\?:\.\*\)/\*\*/g; ##Convert (?:.*) to ** 962 959 $line =~ s/\.\*/\*/g; ##Convert .* to * 963 960 } 964 961 my $count = $line =~ s/^([A-Z]):/$1:\t/g; ··· 1053 1048 if ($file =~ m@^$pattern@) { 1054 1049 my $s1 = ($file =~ tr@/@@); 1055 1050 my $s2 = ($pattern =~ tr@/@@); 1056 - if ($s1 == $s2) { 1051 + if ($s1 == $s2 || $pattern =~ /\(\?:/) { 1057 1052 return 1; 1058 1053 } 1059 1054 }