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>
This commit is contained in:
parent
7ee3aebe31
commit
272a897904
1 changed files with 53 additions and 29 deletions
|
@ -296,46 +296,56 @@ my @status = ();
|
||||||
|
|
||||||
foreach my $file (@files) {
|
foreach my $file (@files) {
|
||||||
|
|
||||||
#Do not match excluded file patterns
|
my %hash;
|
||||||
|
my $tvi = find_first_section();
|
||||||
|
while ($tvi < @typevalue) {
|
||||||
|
my $start = find_starting_index($tvi);
|
||||||
|
my $end = find_ending_index($tvi);
|
||||||
|
my $exclude = 0;
|
||||||
|
my $i;
|
||||||
|
|
||||||
my $exclude = 0;
|
#Do not match excluded file patterns
|
||||||
foreach my $line (@typevalue) {
|
|
||||||
if ($line =~ m/^(\C):\s*(.*)/) {
|
|
||||||
my $type = $1;
|
|
||||||
my $value = $2;
|
|
||||||
if ($type eq 'X') {
|
|
||||||
if (file_match_pattern($file, $value)) {
|
|
||||||
$exclude = 1;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$exclude) {
|
for ($i = $start; $i < $end; $i++) {
|
||||||
my $tvi = 0;
|
my $line = $typevalue[$i];
|
||||||
my %hash;
|
|
||||||
foreach my $line (@typevalue) {
|
|
||||||
if ($line =~ m/^(\C):\s*(.*)/) {
|
if ($line =~ m/^(\C):\s*(.*)/) {
|
||||||
my $type = $1;
|
my $type = $1;
|
||||||
my $value = $2;
|
my $value = $2;
|
||||||
if ($type eq 'F') {
|
if ($type eq 'X') {
|
||||||
if (file_match_pattern($file, $value)) {
|
if (file_match_pattern($file, $value)) {
|
||||||
my $value_pd = ($value =~ tr@/@@);
|
$exclude = 1;
|
||||||
my $file_pd = ($file =~ tr@/@@);
|
}
|
||||||
$value_pd++ if (substr($value,-1,1) ne "/");
|
}
|
||||||
if ($pattern_depth == 0 ||
|
}
|
||||||
(($file_pd - $value_pd) < $pattern_depth)) {
|
}
|
||||||
$hash{$tvi} = $value_pd;
|
|
||||||
|
if (!$exclude) {
|
||||||
|
for ($i = $start; $i < $end; $i++) {
|
||||||
|
my $line = $typevalue[$i];
|
||||||
|
if ($line =~ m/^(\C):\s*(.*)/) {
|
||||||
|
my $type = $1;
|
||||||
|
my $value = $2;
|
||||||
|
if ($type eq 'F') {
|
||||||
|
if (file_match_pattern($file, $value)) {
|
||||||
|
my $value_pd = ($value =~ tr@/@@);
|
||||||
|
my $file_pd = ($file =~ tr@/@@);
|
||||||
|
$value_pd++ if (substr($value,-1,1) ne "/");
|
||||||
|
if ($pattern_depth == 0 ||
|
||||||
|
(($file_pd - $value_pd) < $pattern_depth)) {
|
||||||
|
$hash{$tvi} = $value_pd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tvi++;
|
|
||||||
}
|
|
||||||
foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
|
|
||||||
add_categories($line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tvi += ($end - $start);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
|
||||||
|
add_categories($line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($email && $email_git) {
|
if ($email && $email_git) {
|
||||||
|
@ -570,6 +580,20 @@ sub format_email {
|
||||||
return $formatted_email;
|
return $formatted_email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub find_first_section {
|
||||||
|
my $index = 0;
|
||||||
|
|
||||||
|
while ($index < @typevalue) {
|
||||||
|
my $tv = $typevalue[$index];
|
||||||
|
if (($tv =~ m/^(\C):\s*(.*)/)) {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
$index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $index;
|
||||||
|
}
|
||||||
|
|
||||||
sub find_starting_index {
|
sub find_starting_index {
|
||||||
my ($index) = @_;
|
my ($index) = @_;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue