diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index f46576949ccb..e5a400c53bf0 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -110,10 +110,12 @@ my %VCS_cmds_hg = ( "blame_commit_pattern" => "^([0-9a-f]+):" ); -if (-f "${lk_path}.get_maintainer.conf") { +my $conf = which_conf(".get_maintainer.conf"); +if (-f $conf) { my @conf_args; - open(my $conffile, '<', "${lk_path}.get_maintainer.conf") - or warn "$P: Can't open .get_maintainer.conf: $!\n"; + open(my $conffile, '<', "$conf") + or warn "$P: Can't find a readable .get_maintainer.conf file $!\n"; + while (<$conffile>) { my $line = $_; @@ -961,6 +963,18 @@ sub which { return ""; } +sub which_conf { + my ($conf) = @_; + + foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) { + if (-e "$path/$conf") { + return "$path/$conf"; + } + } + + return ""; +} + sub mailmap { my (@lines) = @_; my %hash;