aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/get_maintainer.pl19
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;
27my $email_git_penguin_chiefs = 0; 27my $email_git_penguin_chiefs = 0;
28my $email_git_min_signatures = 1; 28my $email_git_min_signatures = 1;
29my $email_git_max_maintainers = 5; 29my $email_git_max_maintainers = 5;
30my $email_git_min_percent = 5;
30my $email_git_since = "1-year-ago"; 31my $email_git_since = "1-year-ago";
31my $output_multiline = 1; 32my $output_multiline = 1;
32my $output_separator = ", "; 33my $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;