Commit afa81ee13033de791c41c1d9333853504653939b

Authored by Joe Perches
Committed by Linus Torvalds
1 parent 870020f93a

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>

Showing 1 changed file with 16 additions and 3 deletions Side-by-side Diff

scripts/get_maintainer.pl
... ... @@ -27,6 +27,7 @@
27 27 my $email_git_penguin_chiefs = 0;
28 28 my $email_git_min_signatures = 1;
29 29 my $email_git_max_maintainers = 5;
  30 +my $email_git_min_percent = 5;
30 31 my $email_git_since = "1-year-ago";
31 32 my $output_multiline = 1;
32 33 my $output_separator = ", ";
... ... @@ -65,6 +66,7 @@
65 66 'git-chief-penguins!' => \$email_git_penguin_chiefs,
66 67 'git-min-signatures=i' => \$email_git_min_signatures,
67 68 'git-max-maintainers=i' => \$email_git_max_maintainers,
  69 + 'git-min-percent=i' => \$email_git_min_percent,
68 70 'git-since=s' => \$email_git_since,
69 71 'm!' => \$email_maintainer,
70 72 'n!' => \$email_usename,
... ... @@ -307,6 +309,7 @@
307 309 --git-chief-penguins => include ${penguin_chiefs}
308 310 --git-min-signatures => number of signatures required (default: 1)
309 311 --git-max-maintainers => maximum maintainers to add (default: 5)
  312 + --git-min-percent => minimum percentage of commits required (default: 0)
310 313 --git-since => git history to use (default: 1-year-ago)
311 314 --m => include maintainer(s) if any
312 315 --n => include name 'Full Name <addr\@domain.tld>'
... ... @@ -497,6 +500,7 @@
497 500 my $output = "";
498 501 my $count = 0;
499 502 my @lines = ();
  503 + my $total_sign_offs;
500 504  
501 505 if (which("git") eq "") {
502 506 warn("$P: git not found. Add --nogit to options?\n");
503 507  
504 508  
505 509  
... ... @@ -520,17 +524,26 @@
520 524 $output =~ s/^\s*//gm;
521 525  
522 526 @lines = split("\n", $output);
  527 +
  528 + $total_sign_offs = 0;
523 529 foreach my $line (@lines) {
524 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 +
  537 + foreach my $line (@lines) {
  538 + if ($line =~ m/([0-9]+)\s+(.*)/) {
525 539 my $sign_offs = $1;
526 540 $line = $2;
527 541 $count++;
528 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 545 last;
531 546 }
532   - } else {
533   - die("$P: Unexpected git output: ${line}\n");
534 547 }
535 548 if ($line =~ m/(.+)<(.+)>/) {
536 549 my $git_name = $1;