Commit 2f5bd343 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

scripts/get_maintainer.pl: add signatures from Fixes: <badcommit> lines in commit message

A Fixes: lines in a commit message generally indicate that a previous
commit was inadequate for whatever reason.

The signers of the previous inadequate commit should also be cc'd on
this new commit so update get_maintainer to find the old commit and add
the original signers.

Link: http://lkml.kernel.org/r/33605b9fc0e0f711236951ae84185a6218acff4f.camel@perches.comSigned-off-by: default avatarJoe Perches <joe@perches.com>
Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 24b54fee
...@@ -26,6 +26,7 @@ my $email = 1; ...@@ -26,6 +26,7 @@ my $email = 1;
my $email_usename = 1; my $email_usename = 1;
my $email_maintainer = 1; my $email_maintainer = 1;
my $email_reviewer = 1; my $email_reviewer = 1;
my $email_fixes = 1;
my $email_list = 1; my $email_list = 1;
my $email_moderated_list = 1; my $email_moderated_list = 1;
my $email_subscriber_list = 0; my $email_subscriber_list = 0;
...@@ -249,6 +250,7 @@ if (!GetOptions( ...@@ -249,6 +250,7 @@ if (!GetOptions(
'r!' => \$email_reviewer, 'r!' => \$email_reviewer,
'n!' => \$email_usename, 'n!' => \$email_usename,
'l!' => \$email_list, 'l!' => \$email_list,
'fixes!' => \$email_fixes,
'moderated!' => \$email_moderated_list, 'moderated!' => \$email_moderated_list,
's!' => \$email_subscriber_list, 's!' => \$email_subscriber_list,
'multiline!' => \$output_multiline, 'multiline!' => \$output_multiline,
...@@ -503,6 +505,7 @@ sub read_mailmap { ...@@ -503,6 +505,7 @@ sub read_mailmap {
## use the filenames on the command line or find the filenames in the patchfiles ## use the filenames on the command line or find the filenames in the patchfiles
my @files = (); my @files = ();
my @fixes = (); # If a patch description includes Fixes: lines
my @range = (); my @range = ();
my @keyword_tvi = (); my @keyword_tvi = ();
my @file_emails = (); my @file_emails = ();
...@@ -568,6 +571,8 @@ foreach my $file (@ARGV) { ...@@ -568,6 +571,8 @@ foreach my $file (@ARGV) {
my $filename2 = $2; my $filename2 = $2;
push(@files, $filename1); push(@files, $filename1);
push(@files, $filename2); push(@files, $filename2);
} elsif (m/^Fixes:\s+([0-9a-fA-F]{6,40})/) {
push(@fixes, $1) if ($email_fixes);
} elsif (m/^\+\+\+\s+(\S+)/ or m/^---\s+(\S+)/) { } elsif (m/^\+\+\+\s+(\S+)/ or m/^---\s+(\S+)/) {
my $filename = $1; my $filename = $1;
$filename =~ s@^[^/]*/@@; $filename =~ s@^[^/]*/@@;
...@@ -598,6 +603,7 @@ foreach my $file (@ARGV) { ...@@ -598,6 +603,7 @@ foreach my $file (@ARGV) {
} }
@file_emails = uniq(@file_emails); @file_emails = uniq(@file_emails);
@fixes = uniq(@fixes);
my %email_hash_name; my %email_hash_name;
my %email_hash_address; my %email_hash_address;
...@@ -612,7 +618,6 @@ my %deduplicate_name_hash = (); ...@@ -612,7 +618,6 @@ my %deduplicate_name_hash = ();
my %deduplicate_address_hash = (); my %deduplicate_address_hash = ();
my @maintainers = get_maintainers(); my @maintainers = get_maintainers();
if (@maintainers) { if (@maintainers) {
@maintainers = merge_email(@maintainers); @maintainers = merge_email(@maintainers);
output(@maintainers); output(@maintainers);
...@@ -927,6 +932,10 @@ sub get_maintainers { ...@@ -927,6 +932,10 @@ sub get_maintainers {
} }
} }
foreach my $fix (@fixes) {
vcs_add_commit_signers($fix, "blamed_fixes");
}
foreach my $email (@email_to, @list_to) { foreach my $email (@email_to, @list_to) {
$email->[0] = deduplicate_email($email->[0]); $email->[0] = deduplicate_email($email->[0]);
} }
...@@ -1031,6 +1040,7 @@ MAINTAINER field selection options: ...@@ -1031,6 +1040,7 @@ MAINTAINER field selection options:
--roles => show roles (status:subsystem, git-signer, list, etc...) --roles => show roles (status:subsystem, git-signer, list, etc...)
--rolestats => show roles and statistics (commits/total_commits, %) --rolestats => show roles and statistics (commits/total_commits, %)
--file-emails => add email addresses found in -f file (default: 0 (off)) --file-emails => add email addresses found in -f file (default: 0 (off))
--fixes => for patches, add signatures of commits with 'Fixes: <commit>' (default: 1 (on))
--scm => print SCM tree(s) if any --scm => print SCM tree(s) if any
--status => print status if any --status => print status if any
--subsystem => print subsystem name if any --subsystem => print subsystem name if any
...@@ -1730,6 +1740,32 @@ sub vcs_is_hg { ...@@ -1730,6 +1740,32 @@ sub vcs_is_hg {
return $vcs_used == 2; return $vcs_used == 2;
} }
sub vcs_add_commit_signers {
return if (!vcs_exists());
my ($commit, $desc) = @_;
my $commit_count = 0;
my $commit_authors_ref;
my $commit_signers_ref;
my $stats_ref;
my @commit_authors = ();
my @commit_signers = ();
my $cmd;
$cmd = $VCS_cmds{"find_commit_signers_cmd"};
$cmd =~ s/(\$\w+)/$1/eeg; #substitute variables in $cmd
($commit_count, $commit_signers_ref, $commit_authors_ref, $stats_ref) = vcs_find_signers($cmd, "");
@commit_authors = @{$commit_authors_ref} if defined $commit_authors_ref;
@commit_signers = @{$commit_signers_ref} if defined $commit_signers_ref;
foreach my $signer (@commit_signers) {
$signer = deduplicate_email($signer);
}
vcs_assign($desc, 1, @commit_signers);
}
sub interactive_get_maintainers { sub interactive_get_maintainers {
my ($list_ref) = @_; my ($list_ref) = @_;
my @list = @$list_ref; my @list = @$list_ref;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment