aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-01-08 17:42:48 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-01-11 12:34:05 -0500
commit272a897904b9a067550f5b8e812036b65180418f (patch)
treeb4f249fa0c6bc329443f35d52f92ee59a2a40a49 /scripts
parent7ee3aebe31d2cb22c84e1c8f48182947b13a3607 (diff)
scripts/get_maintainer.pl: fix file exclusion X: logic
The following command doesn't generate any output. `./scripts/get_maintainer.pl --no-git -f drivers/net/wireless/wl12xx/wl1271_acx.c` An excluded "X:" pattern match in any section would cause a file not to match any other section. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Dan Carpenter <error27@gmail.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.pl84
1 files changed, 54 insertions, 30 deletions
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 445e8845f0a4..090f24839700 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -296,46 +296,56 @@ my @status = ();
296 296
297foreach my $file (@files) { 297foreach my $file (@files) {
298 298
299#Do not match excluded file patterns 299 my %hash;
300 300 my $tvi = find_first_section();
301 my $exclude = 0; 301 while ($tvi < @typevalue) {
302 foreach my $line (@typevalue) { 302 my $start = find_starting_index($tvi);
303 if ($line =~ m/^(\C):\s*(.*)/) { 303 my $end = find_ending_index($tvi);
304 my $type = $1; 304 my $exclude = 0;
305 my $value = $2; 305 my $i;
306 if ($type eq 'X') { 306
307 if (file_match_pattern($file, $value)) { 307 #Do not match excluded file patterns
308 $exclude = 1;
309 last;
310 }
311 }
312 }
313 }
314 308
315 if (!$exclude) { 309 for ($i = $start; $i < $end; $i++) {
316 my $tvi = 0; 310 my $line = $typevalue[$i];
317 my %hash;
318 foreach my $line (@typevalue) {
319 if ($line =~ m/^(\C):\s*(.*)/) { 311 if ($line =~ m/^(\C):\s*(.*)/) {
320 my $type = $1; 312 my $type = $1;
321 my $value = $2; 313 my $value = $2;
322 if ($type eq 'F') { 314 if ($type eq 'X') {
323 if (file_match_pattern($file, $value)) { 315 if (file_match_pattern($file, $value)) {
324 my $value_pd = ($value =~ tr@/@@); 316 $exclude = 1;
325 my $file_pd = ($file =~ tr@/@@);
326 $value_pd++ if (substr($value,-1,1) ne "/");
327 if ($pattern_depth == 0 ||
328 (($file_pd - $value_pd) < $pattern_depth)) {
329 $hash{$tvi} = $value_pd;
330 }
331 } 317 }
332 } 318 }
333 } 319 }
334 $tvi++;
335 } 320 }
336 foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { 321
337 add_categories($line); 322 if (!$exclude) {
323 for ($i = $start; $i < $end; $i++) {
324 my $line = $typevalue[$i];
325 if ($line =~ m/^(\C):\s*(.*)/) {
326 my $type = $1;
327 my $value = $2;
328 if ($type eq 'F') {
329 if (file_match_pattern($file, $value)) {
330 my $value_pd = ($value =~ tr@/@@);
331 my $file_pd = ($file =~ tr@/@@);
332 $value_pd++ if (substr($value,-1,1) ne "/");
333 if ($pattern_depth == 0 ||
334 (($file_pd - $value_pd) < $pattern_depth)) {
335 $hash{$tvi} = $value_pd;
336 }
337 }
338 }
339 }
340 }
338 } 341 }
342
343 $tvi += ($end - $start);
344
345 }
346
347 foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
348 add_categories($line);
339 } 349 }
340 350
341 if ($email && $email_git) { 351 if ($email && $email_git) {
@@ -570,6 +580,20 @@ sub format_email {
570 return $formatted_email; 580 return $formatted_email;
571} 581}
572 582
583sub find_first_section {
584 my $index = 0;
585
586 while ($index < @typevalue) {
587 my $tv = $typevalue[$index];
588 if (($tv =~ m/^(\C):\s*(.*)/)) {
589 last;
590 }
591 $index++;
592 }
593
594 return $index;
595}
596
573sub find_starting_index { 597sub find_starting_index {
574 my ($index) = @_; 598 my ($index) = @_;
575 599