mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeffy Chen <jeffy.chen@rock-chips.com>
To: linux-kernel@vger.kernel.org
Cc: joe@perches.com, briannorris@chromium.org, dianders@chromium.org,
	Jeffy Chen <jeffy.chen@rock-chips.com>
Subject: [PATCH] get_maintainer: apply all .get_maintainer.ignore files
Date: Wed,  5 Apr 2017 19:30:11 +0800	[thread overview]
Message-ID: <1491391811-1027-1-git-send-email-jeffy.chen@rock-chips.com> (raw)

Currently we are searching "./:$ENV{HOME}/:.scripts/" for ignore file,
but would always get "./.get_maintainer.ignore" only.

This patch applies all .get_maintainer.ignore, so it would be easier to
add ignore list locally.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---

 scripts/get_maintainer.pl | 49 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 18 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 633f2dd..357e171 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -193,24 +193,26 @@ if (-f $conf) {
 }
 
 my @ignore_emails = ();
-my $ignore_file = which_conf(".get_maintainer.ignore");
-if (-f $ignore_file) {
-    open(my $ignore, '<', "$ignore_file")
-	or warn "$P: Can't find a readable .get_maintainer.ignore file $!\n";
-    while (<$ignore>) {
-	my $line = $_;
-
-	$line =~ s/\s*\n?$//;
-	$line =~ s/^\s*//;
-	$line =~ s/\s+$//;
-	$line =~ s/#.*$//;
-
-	next if ($line =~ m/^\s*$/);
-	if (rfc822_valid($line)) {
-	    push(@ignore_emails, $line);
+my @ignore_files = which_confs(".get_maintainer.ignore");
+foreach my $ignore_file (@ignore_files) {
+    if (-f $ignore_file) {
+	open(my $ignore, '<', "$ignore_file")
+	    or warn "$P: Can't find a readable .get_maintainer.ignore file $!\n";
+	while (<$ignore>) {
+	    my $line = $_;
+
+	    $line =~ s/\s*\n?$//;
+	    $line =~ s/^\s*//;
+	    $line =~ s/\s+$//;
+	    $line =~ s/#.*$//;
+
+	    next if ($line =~ m/^\s*$/);
+	    if (rfc822_valid($line)) {
+		push(@ignore_emails, $line);
+	    }
 	}
+	close($ignore);
     }
-    close($ignore);
 }
 
 if (!GetOptions(
@@ -1237,15 +1239,26 @@ sub which {
     return "";
 }
 
-sub which_conf {
+sub which_confs {
     my ($conf) = @_;
+    my @confs = ();
 
     foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) {
 	if (-e "$path/$conf") {
-	    return "$path/$conf";
+	    push(@confs, "$path/$conf");
 	}
     }
 
+    return @confs;
+}
+
+sub which_conf {
+    my @confs = which_confs(@_);
+
+    if (@confs) {
+	return $confs[0];
+    }
+
     return "";
 }
 
-- 
2.1.4

             reply	other threads:[~2017-04-05 11:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05 11:30 Jeffy Chen [this message]
2017-04-05 16:06 ` Joe Perches
2017-04-06  1:16   ` jeffy
2017-04-06  1:21     ` 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=1491391811-1027-1-git-send-email-jeffy.chen@rock-chips.com \
    --to=jeffy.chen@rock-chips.com \
    --cc=briannorris@chromium.org \
    --cc=dianders@chromium.org \
    --cc=joe@perches.com \
    --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®