Commit ab6c937dbadf4797484d00d2815e1e3b0ec54397

Authored by Joe Perches
Committed by Linus Torvalds
1 parent 7e1863af16

scripts/get_maintainer.pl: use --git-fallback more often

On Fri, 2010-11-05 at 13:50 -0700, Andrew Morton wrote:
> z:/usr/src/git26> perl scripts/get_maintainer.pl -file mm/mempolicy.c
> linux-mm@kvack.org
> linux-kernel@vger.kernel.org

Turns out this is an arguable defect in the script.

The MAINTAINERS entry for mm is:

MEMORY MANAGEMENT
L:	linux-mm@kvack.org
W:	http://www.linux-mm.org
S:	Maintained
F:	include/linux/mm.h
F:	mm/

There's a maintainer entry, but no named individual, so the script doesn't
use git history via --git-fallback.

This is also a defect for MAINTAINERS with status entries marked "Orphan"
or "Odd fixes".

The script now checks a section for any "M:" entry and that an "S:" entry
is supported or maintained.  If both those conditions are not satisified,
use --git-fallback as appropriate.

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>

Showing 1 changed file with 37 additions and 1 deletions Side-by-side Diff

scripts/get_maintainer.pl
... ... @@ -494,6 +494,40 @@
494 494  
495 495 exit($exit);
496 496  
  497 +sub range_is_maintained {
  498 + my ($start, $end) = @_;
  499 +
  500 + for (my $i = $start; $i < $end; $i++) {
  501 + my $line = $typevalue[$i];
  502 + if ($line =~ m/^(\C):\s*(.*)/) {
  503 + my $type = $1;
  504 + my $value = $2;
  505 + if ($type eq 'S') {
  506 + if ($value =~ /(maintain|support)/i) {
  507 + return 1;
  508 + }
  509 + }
  510 + }
  511 + }
  512 + return 0;
  513 +}
  514 +
  515 +sub range_has_maintainer {
  516 + my ($start, $end) = @_;
  517 +
  518 + for (my $i = $start; $i < $end; $i++) {
  519 + my $line = $typevalue[$i];
  520 + if ($line =~ m/^(\C):\s*(.*)/) {
  521 + my $type = $1;
  522 + my $value = $2;
  523 + if ($type eq 'M') {
  524 + return 1;
  525 + }
  526 + }
  527 + }
  528 + return 0;
  529 +}
  530 +
497 531 sub get_maintainers {
498 532 %email_hash_name = ();
499 533 %email_hash_address = ();
... ... @@ -556,7 +590,9 @@
556 590 my $file_pd = ($file =~ tr@/@@);
557 591 $value_pd++ if (substr($value,-1,1) ne "/");
558 592 $value_pd = -1 if ($value =~ /^\.\*/);
559   - if ($value_pd >= $file_pd) {
  593 + if ($value_pd >= $file_pd &&
  594 + range_is_maintained($start, $end) &&
  595 + range_has_maintainer($start, $end)) {
560 596 $exact_pattern_match_hash{$file} = 1;
561 597 }
562 598 if ($pattern_depth == 0 ||