Skip to contentSkip to conversation

scripts/get_maintainer.pl: Use vcs history of pattern match

RFC PATCH New Joe Perches 1 participant 1 message Sep 26, 2010 GET_MAINTAINER script

lore
Share & tools
lore

Joe Perches

author maintainer
#0 lore raw

RFC PATCH 1/1 scripts/get_maintainer.pl: Use vcs history of pattern match

When users make changes to individual files in a directory, git history of just that file is searched. This can lead to poor generated results as the directory could actually be the preferred history unit to find maintainers.

When a file has an exact pattern match, which may be a directory, search the pattern matched rather than the file.

This may not work well for file in an active directory like kernel/, because it does not have a named maintainer.

---
 scripts/get_maintainer.pl |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
scripts/get_maintainer.pl +10 -2
index d21ec3a..9a3627a 100755
@@ -508,6 +508,7 @@ sub get_maintainers {
     @status = ();
     %deduplicate_name_hash = ();
     %deduplicate_address_hash = ();
+
     if ($email_git_all_signature_types) {
 	$signature_pattern = "(.+?)[Bb][Yy]:";
     } else {
@@ -515,8 +516,8 @@ sub get_maintainers {
     }
 
     # Find responsible parties
-
     my %exact_pattern_match_hash = ();
+    my %matched_pattern_hash = ();
 
     foreach my $file (@files) {
 
@@ -558,6 +559,7 @@ sub get_maintainers {
 				$value_pd = -1 if ($value =~ /^\.\*/);
 				if ($value_pd >= $file_pd) {
 				    $exact_pattern_match_hash{$file} = 1;
+				    $matched_pattern_hash{$value}++;
 				}
 				if ($pattern_depth == 0 ||
 				    (($file_pd - $value_pd) < $pattern_depth)) {
@@ -608,7 +610,13 @@ sub get_maintainers {
 	if ($email &&
 	    ($email_git || ($email_git_fallback &&
 			    !$exact_pattern_match_hash{$file}))) {
-	    vcs_file_signoffs($file);
+	    my $vcs_pattern;
+	    if (scalar keys %matched_pattern_hash) {
+		$vcs_pattern = join(" ", keys %matched_pattern_hash);
+	    } else {
+		$vcs_pattern = $file;
+	    }
+	    vcs_file_signoffs($vcs_pattern);
 	}
 	if ($email && $email_git_blame) {
 	    vcs_file_blame($file);