summaryrefslogtreecommitdiffstats
path: root/scripts/get_maintainer.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2016-08-02 17:04:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-02 19:35:07 -0400
commit4cad35a7ca690eabf0d241062ce9e59693ec03e7 (patch)
treed7d849bfe968173fe6109c3ffcdb612691025c01 /scripts/get_maintainer.pl
parent750afe7babd117daabebf4855da18e4418ea845e (diff)
get_maintainer.pl: reduce need for command-line option -f
If a vcs is used, look to see if the vcs tracks the file specified and so the -f option becomes optional. Link: http://lkml.kernel.org/r/7c86a8df0d48770c45778a43b6b3e4627b2a90ee.1469746395.git.joe@perches.com 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>
Diffstat (limited to 'scripts/get_maintainer.pl')
-rwxr-xr-xscripts/get_maintainer.pl20
1 files changed, 19 insertions, 1 deletions
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 1873421f2305..122fcdaf42c8 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -133,6 +133,7 @@ my %VCS_cmds_git = (
133 "author_pattern" => "^GitAuthor: (.*)", 133 "author_pattern" => "^GitAuthor: (.*)",
134 "subject_pattern" => "^GitSubject: (.*)", 134 "subject_pattern" => "^GitSubject: (.*)",
135 "stat_pattern" => "^(\\d+)\\t(\\d+)\\t\$file\$", 135 "stat_pattern" => "^(\\d+)\\t(\\d+)\\t\$file\$",
136 "file_exists_cmd" => "git ls-files \$file",
136); 137);
137 138
138my %VCS_cmds_hg = ( 139my %VCS_cmds_hg = (
@@ -161,6 +162,7 @@ my %VCS_cmds_hg = (
161 "author_pattern" => "^HgAuthor: (.*)", 162 "author_pattern" => "^HgAuthor: (.*)",
162 "subject_pattern" => "^HgSubject: (.*)", 163 "subject_pattern" => "^HgSubject: (.*)",
163 "stat_pattern" => "^(\\d+)\t(\\d+)\t\$file\$", 164 "stat_pattern" => "^(\\d+)\t(\\d+)\t\$file\$",
165 "file_exists_cmd" => "hg files \$file",
164); 166);
165 167
166my $conf = which_conf(".get_maintainer.conf"); 168my $conf = which_conf(".get_maintainer.conf");
@@ -430,7 +432,7 @@ foreach my $file (@ARGV) {
430 die "$P: file '${file}' not found\n"; 432 die "$P: file '${file}' not found\n";
431 } 433 }
432 } 434 }
433 if ($from_filename) { 435 if ($from_filename || vcs_file_exists($file)) {
434 $file =~ s/^\Q${cur_path}\E//; #strip any absolute path 436 $file =~ s/^\Q${cur_path}\E//; #strip any absolute path
435 $file =~ s/^\Q${lk_path}\E//; #or the path to the lk tree 437 $file =~ s/^\Q${lk_path}\E//; #or the path to the lk tree
436 push(@files, $file); 438 push(@files, $file);
@@ -2124,6 +2126,22 @@ sub vcs_file_blame {
2124 } 2126 }
2125} 2127}
2126 2128
2129sub vcs_file_exists {
2130 my ($file) = @_;
2131
2132 my $exists;
2133
2134 my $vcs_used = vcs_exists();
2135 return 0 if (!$vcs_used);
2136
2137 my $cmd = $VCS_cmds{"file_exists_cmd"};
2138 $cmd =~ s/(\$\w+)/$1/eeg; # interpolate $cmd
2139
2140 $exists = &{$VCS_cmds{"execute_cmd"}}($cmd);
2141
2142 return $exists;
2143}
2144
2127sub uniq { 2145sub uniq {
2128 my (@parms) = @_; 2146 my (@parms) = @_;
2129 2147