mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Julia Lawall <julia@diku.dk>, Greg KH <greg@kroah.com>
Subject: [PATCH 2/7] scripts/get_maintainer.pl: Add sections in pattern match depth order
Date: Wed,  5 Aug 2009 19:43:43 -0700	[thread overview]
Message-ID: <0b6f4e55641868094dd770f5e2bdbf093c473b26.1249525834.git.joe@perches.com> (raw)
In-Reply-To: <cover.1249525834.git.joe@perches.com>

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>
---
 scripts/get_maintainer.pl |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 35781e0..fb446e0 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -211,6 +211,7 @@ foreach my $file (@files) {
 	    if ($type eq 'X') {
 		if (file_match_pattern($file, $value)) {
 		    $exclude = 1;
+		    last;
 		}
 	    }
 	}
@@ -218,18 +219,24 @@ foreach my $file (@files) {
 
     if (!$exclude) {
 	my $tvi = 0;
+	my %hash;
 	foreach my $line (@typevalue) {
 	    if ($line =~ m/^(\C):\s*(.*)/) {
 		my $type = $1;
 		my $value = $2;
 		if ($type eq 'F') {
 		    if (file_match_pattern($file, $value)) {
-			add_categories($tvi);
+			my $pattern_depth = ($value =~ tr@/@@);
+			$pattern_depth++ if (!(substr($value,-1,1) eq "/"));
+			$hash{$tvi} = $pattern_depth;
 		    }
 		}
 	    }
 	    $tvi++;
 	}
+	foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
+	    add_categories($line);
+	}
     }
 
     if ($email && $email_git) {
-- 
1.6.3.1.10.g659a0.dirty


  parent reply	other threads:[~2009-08-06  2:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-06  2:43 [PATCH 0/7] scripts/get_maintainer.pl: New features Joe Perches
2009-08-06  2:43 ` [PATCH 1/7] scripts/get_maintainer.pl: Add --git-blame Joe Perches
2009-08-06  2:43 ` Joe Perches [this message]
2009-08-06  3:51   ` [PATCH 2/7] scripts/get_maintainer.pl: Add sections in pattern match depth order Greg KH
2009-08-06  2:43 ` [PATCH 3/7] scripts/get_maintainer.pl: Add --pattern-depth Joe Perches
2009-08-06  2:43 ` [PATCH 4/7] scripts/get_maintainer.pl: Better email routines, use perl not shell where possible Joe Perches
2009-08-06  2:43 ` [PATCH 5/7] scripts/get_maintainer.pl: Add .mailmap use, shell and email cleanups Joe Perches
2009-08-06  2:43 ` [PATCH 6/7] scripts/get_maintainer.pl: Using --separator implies --nomultiline Joe Perches
2009-08-06  2:43 ` [PATCH 7/7] scripts/get_maintainer.pl: Add --remove-duplicates Joe Perches
2009-08-06  3:54 ` [PATCH 0/7] scripts/get_maintainer.pl: New features Greg KH
2009-08-26 21:48 ` [PATCH] scripts/get_maintainer.pl: Add maintainers in order listed in matched section Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b6f4e55641868094dd770f5e2bdbf093c473b26.1249525834.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=greg@kroah.com \
    --cc=julia@diku.dk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®