Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.com
Signed-off-by: Joe Perches <joe@perches.com>
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Joe Perches and committed by
Linus Torvalds
2f5bd343 24b54fee

+37 -1
+37 -1
scripts/get_maintainer.pl
··· 26 26 my $email_usename = 1; 27 27 my $email_maintainer = 1; 28 28 my $email_reviewer = 1; 29 + my $email_fixes = 1; 29 30 my $email_list = 1; 30 31 my $email_moderated_list = 1; 31 32 my $email_subscriber_list = 0; ··· 250 249 'r!' => \$email_reviewer, 251 250 'n!' => \$email_usename, 252 251 'l!' => \$email_list, 252 + 'fixes!' => \$email_fixes, 253 253 'moderated!' => \$email_moderated_list, 254 254 's!' => \$email_subscriber_list, 255 255 'multiline!' => \$output_multiline, ··· 505 503 ## use the filenames on the command line or find the filenames in the patchfiles 506 504 507 505 my @files = (); 506 + my @fixes = (); # If a patch description includes Fixes: lines 508 507 my @range = (); 509 508 my @keyword_tvi = (); 510 509 my @file_emails = (); ··· 571 568 my $filename2 = $2; 572 569 push(@files, $filename1); 573 570 push(@files, $filename2); 571 + } elsif (m/^Fixes:\s+([0-9a-fA-F]{6,40})/) { 572 + push(@fixes, $1) if ($email_fixes); 574 573 } elsif (m/^\+\+\+\s+(\S+)/ or m/^---\s+(\S+)/) { 575 574 my $filename = $1; 576 575 $filename =~ s@^[^/]*/@@; ··· 603 598 } 604 599 605 600 @file_emails = uniq(@file_emails); 601 + @fixes = uniq(@fixes); 606 602 607 603 my %email_hash_name; 608 604 my %email_hash_address; ··· 618 612 my %deduplicate_address_hash = (); 619 613 620 614 my @maintainers = get_maintainers(); 621 - 622 615 if (@maintainers) { 623 616 @maintainers = merge_email(@maintainers); 624 617 output(@maintainers); ··· 932 927 } 933 928 } 934 929 930 + foreach my $fix (@fixes) { 931 + vcs_add_commit_signers($fix, "blamed_fixes"); 932 + } 933 + 935 934 foreach my $email (@email_to, @list_to) { 936 935 $email->[0] = deduplicate_email($email->[0]); 937 936 } ··· 1040 1031 --roles => show roles (status:subsystem, git-signer, list, etc...) 1041 1032 --rolestats => show roles and statistics (commits/total_commits, %) 1042 1033 --file-emails => add email addresses found in -f file (default: 0 (off)) 1034 + --fixes => for patches, add signatures of commits with 'Fixes: <commit>' (default: 1 (on)) 1043 1035 --scm => print SCM tree(s) if any 1044 1036 --status => print status if any 1045 1037 --subsystem => print subsystem name if any ··· 1738 1728 1739 1729 sub vcs_is_hg { 1740 1730 return $vcs_used == 2; 1731 + } 1732 + 1733 + sub vcs_add_commit_signers { 1734 + return if (!vcs_exists()); 1735 + 1736 + my ($commit, $desc) = @_; 1737 + my $commit_count = 0; 1738 + my $commit_authors_ref; 1739 + my $commit_signers_ref; 1740 + my $stats_ref; 1741 + my @commit_authors = (); 1742 + my @commit_signers = (); 1743 + my $cmd; 1744 + 1745 + $cmd = $VCS_cmds{"find_commit_signers_cmd"}; 1746 + $cmd =~ s/(\$\w+)/$1/eeg; #substitute variables in $cmd 1747 + 1748 + ($commit_count, $commit_signers_ref, $commit_authors_ref, $stats_ref) = vcs_find_signers($cmd, ""); 1749 + @commit_authors = @{$commit_authors_ref} if defined $commit_authors_ref; 1750 + @commit_signers = @{$commit_signers_ref} if defined $commit_signers_ref; 1751 + 1752 + foreach my $signer (@commit_signers) { 1753 + $signer = deduplicate_email($signer); 1754 + } 1755 + 1756 + vcs_assign($desc, 1, @commit_signers); 1741 1757 } 1742 1758 1743 1759 sub interactive_get_maintainers {