diff options
author | Joe Perches <joe@perches.com> | 2009-07-29 18:04:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-29 22:10:41 -0400 |
commit | afa81ee13033de791c41c1d9333853504653939b (patch) | |
tree | b075dbae0145871b666e6da0a80fdcb61f9a2eef /scripts | |
parent | 870020f93af2323a81f179091a0780dc1d5b916b (diff) |
get_maintainer.pl: Add git-min-percent option
Allow an option to control the minimum percentage of sign-offs required
before being considered a maintainer.
git-min-percent has a default value of 5
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')
-rwxr-xr-x | scripts/get_maintainer.pl | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 7fc09fc91e8b..61ef27564ed6 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -27,6 +27,7 @@ my $email_git = 1; | |||
27 | my $email_git_penguin_chiefs = 0; | 27 | my $email_git_penguin_chiefs = 0; |
28 | my $email_git_min_signatures = 1; | 28 | my $email_git_min_signatures = 1; |
29 | my $email_git_max_maintainers = 5; | 29 | my $email_git_max_maintainers = 5; |
30 | my $email_git_min_percent = 5; | ||
30 | my $email_git_since = "1-year-ago"; | 31 | my $email_git_since = "1-year-ago"; |
31 | my $output_multiline = 1; | 32 | my $output_multiline = 1; |
32 | my $output_separator = ", "; | 33 | my $output_separator = ", "; |
@@ -65,6 +66,7 @@ if (!GetOptions( | |||
65 | 'git-chief-penguins!' => \$email_git_penguin_chiefs, | 66 | 'git-chief-penguins!' => \$email_git_penguin_chiefs, |
66 | 'git-min-signatures=i' => \$email_git_min_signatures, | 67 | 'git-min-signatures=i' => \$email_git_min_signatures, |
67 | 'git-max-maintainers=i' => \$email_git_max_maintainers, | 68 | 'git-max-maintainers=i' => \$email_git_max_maintainers, |
69 | 'git-min-percent=i' => \$email_git_min_percent, | ||
68 | 'git-since=s' => \$email_git_since, | 70 | 'git-since=s' => \$email_git_since, |
69 | 'm!' => \$email_maintainer, | 71 | 'm!' => \$email_maintainer, |
70 | 'n!' => \$email_usename, | 72 | 'n!' => \$email_usename, |
@@ -307,6 +309,7 @@ MAINTAINER field selection options: | |||
307 | --git-chief-penguins => include ${penguin_chiefs} | 309 | --git-chief-penguins => include ${penguin_chiefs} |
308 | --git-min-signatures => number of signatures required (default: 1) | 310 | --git-min-signatures => number of signatures required (default: 1) |
309 | --git-max-maintainers => maximum maintainers to add (default: 5) | 311 | --git-max-maintainers => maximum maintainers to add (default: 5) |
312 | --git-min-percent => minimum percentage of commits required (default: 0) | ||
310 | --git-since => git history to use (default: 1-year-ago) | 313 | --git-since => git history to use (default: 1-year-ago) |
311 | --m => include maintainer(s) if any | 314 | --m => include maintainer(s) if any |
312 | --n => include name 'Full Name <addr\@domain.tld>' | 315 | --n => include name 'Full Name <addr\@domain.tld>' |
@@ -497,6 +500,7 @@ sub recent_git_signoffs { | |||
497 | my $output = ""; | 500 | my $output = ""; |
498 | my $count = 0; | 501 | my $count = 0; |
499 | my @lines = (); | 502 | my @lines = (); |
503 | my $total_sign_offs; | ||
500 | 504 | ||
501 | if (which("git") eq "") { | 505 | if (which("git") eq "") { |
502 | warn("$P: git not found. Add --nogit to options?\n"); | 506 | warn("$P: git not found. Add --nogit to options?\n"); |
@@ -520,17 +524,26 @@ sub recent_git_signoffs { | |||
520 | $output =~ s/^\s*//gm; | 524 | $output =~ s/^\s*//gm; |
521 | 525 | ||
522 | @lines = split("\n", $output); | 526 | @lines = split("\n", $output); |
527 | |||
528 | $total_sign_offs = 0; | ||
529 | foreach my $line (@lines) { | ||
530 | if ($line =~ m/([0-9]+)\s+(.*)/) { | ||
531 | $total_sign_offs += $1; | ||
532 | } else { | ||
533 | die("$P: Unexpected git output: ${line}\n"); | ||
534 | } | ||
535 | } | ||
536 | |||
523 | foreach my $line (@lines) { | 537 | foreach my $line (@lines) { |
524 | if ($line =~ m/([0-9]+)\s+(.*)/) { | 538 | if ($line =~ m/([0-9]+)\s+(.*)/) { |
525 | my $sign_offs = $1; | 539 | my $sign_offs = $1; |
526 | $line = $2; | 540 | $line = $2; |
527 | $count++; | 541 | $count++; |
528 | if ($sign_offs < $email_git_min_signatures || | 542 | if ($sign_offs < $email_git_min_signatures || |
529 | $count > $email_git_max_maintainers) { | 543 | $count > $email_git_max_maintainers || |
544 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent) { | ||
530 | last; | 545 | last; |
531 | } | 546 | } |
532 | } else { | ||
533 | die("$P: Unexpected git output: ${line}\n"); | ||
534 | } | 547 | } |
535 | if ($line =~ m/(.+)<(.+)>/) { | 548 | if ($line =~ m/(.+)<(.+)>/) { |
536 | my $git_name = $1; | 549 | my $git_name = $1; |