aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2009-09-21 20:04:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 10:17:46 -0400
commit1d606b4e0bf8fe45e3f88543dfce83207ae0027d (patch)
tree3ce6a2d59ce2240b21d60afc929d58999e9efbc7 /scripts
parentf5492666a3b62344de9026a960c11888160362c9 (diff)
scripts/get_maintainer.pl: add sections in pattern match depth order
Before this change, matched sections were added in the order of appearance in the normally alphabetic section order of the MAINTAINERS file. For instance, finding the maintainer for drivers/scsi/wd7000.c would first find "SCSI SUBSYSTEM", then "WD7000 SCSI SUBSYSTEM", then "THE REST". before patch: $ ./scripts/get_maintainer.pl --nogit -f drivers/scsi/wd7000.c James E.J. Bottomley <James.Bottomley@HansenPartnership.com> Miroslav Zagorac <zaga@fly.cc.fer.hr> linux-scsi@vger.kernel.org linux-kernel@vger.kernel.org get_maintainer.pl now selects matched sections by longest pattern match. Longest is the number of "/"s and any specific file pattern. This changes the example output order of MAINTAINERS to whatever is selected in "WD7000 SUBSYSTEM", then "SCSI SYSTEM", then "THE REST". after patch: $ ./scripts/get_maintainer.pl --nogit -f drivers/scsi/wd7000.c Miroslav Zagorac <zaga@fly.cc.fer.hr> James E.J. Bottomley <James.Bottomley@HansenPartnership.com> linux-scsi@vger.kernel.org linux-kernel@vger.kernel.org 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>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/get_maintainer.pl9
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 35781e0d43e6..fb446e0f8bbf 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -211,6 +211,7 @@ foreach my $file (@files) {
211 if ($type eq 'X') { 211 if ($type eq 'X') {
212 if (file_match_pattern($file, $value)) { 212 if (file_match_pattern($file, $value)) {
213 $exclude = 1; 213 $exclude = 1;
214 last;
214 } 215 }
215 } 216 }
216 } 217 }
@@ -218,18 +219,24 @@ foreach my $file (@files) {
218 219
219 if (!$exclude) { 220 if (!$exclude) {
220 my $tvi = 0; 221 my $tvi = 0;
222 my %hash;
221 foreach my $line (@typevalue) { 223 foreach my $line (@typevalue) {
222 if ($line =~ m/^(\C):\s*(.*)/) { 224 if ($line =~ m/^(\C):\s*(.*)/) {
223 my $type = $1; 225 my $type = $1;
224 my $value = $2; 226 my $value = $2;
225 if ($type eq 'F') { 227 if ($type eq 'F') {
226 if (file_match_pattern($file, $value)) { 228 if (file_match_pattern($file, $value)) {
227 add_categories($tvi); 229 my $pattern_depth = ($value =~ tr@/@@);
230 $pattern_depth++ if (!(substr($value,-1,1) eq "/"));
231 $hash{$tvi} = $pattern_depth;
228 } 232 }
229 } 233 }
230 } 234 }
231 $tvi++; 235 $tvi++;
232 } 236 }
237 foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
238 add_categories($line);
239 }
233 } 240 }
234 241
235 if ($email && $email_git) { 242 if ($email && $email_git) {