Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1616862

[PATCH] get_maintainer: apply all .get_maintainer.ignore files

From Jeffy Chen <jeffy.chen@rock-chips.com>
Newsgroups linux.kernel
Subject [PATCH] get_maintainer: apply all .get_maintainer.ignore files
Date 2017-04-05 13:40 +0200
Message-ID <tsRs6-22m-27@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View 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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] get_maintainer: apply all .get_maintainer.ignore files Jeffy Chen <jeffy.chen@rock-chips.com> - 2017-04-05 13:40 +0200
  Re: [PATCH] get_maintainer: apply all .get_maintainer.ignore files Joe Perches <joe@perches.com> - 2017-04-05 18:10 +0200
    Re: [PATCH] get_maintainer: apply all .get_maintainer.ignore files jeffy <jeffy.chen@rock-chips.com> - 2017-04-06 03:20 +0200
      Re: [PATCH] get_maintainer: apply all .get_maintainer.ignore files Joe Perches <joe@perches.com> - 2017-04-06 03:30 +0200

csiph-web