aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Sadie Powell2024-09-02 11:16:13 +0100
committerGravatar Sadie Powell2024-09-02 11:47:53 +0100
commit266cc6c3c3fe514e1fbb08f72726efdd2f329525 (patch)
treef3a1a346ddb65735590338d92774e0b9c4aa82cd
parentFix a regression in ProcessColors. (diff)
Make mkauthors/mkheaders respect the mailmap for coauthors.
-rwxr-xr-xtools/mkauthors15
-rwxr-xr-xtools/mkheaders6
2 files changed, 15 insertions, 6 deletions
diff --git a/tools/mkauthors b/tools/mkauthors
index c52adb907..b41ec6c47 100755
--- a/tools/mkauthors
+++ b/tools/mkauthors
@@ -30,14 +30,23 @@ use lib dirname $RealDir;
use make::common;
use make::console;
+my %committers;
+for my $committer (split /\n+/, `git log --pretty='%an <%ae>%n%(trailers:key=Co-Authored-By,valueonly)' HEAD`) {
+ $committers{$committer} ||= 0;
+ $committers{$committer} += 1;
+}
+
my %authors;
-for my $author (split /\n+/, `git log --pretty='%aN <%aE>%n%(trailers:key=Co-Authored-By,valueonly)' HEAD`) {
+for my $committer (keys %committers) {
+ open(my $fh, '-|', 'git', 'check-mailmap', $committer);
+ chomp(my $author = <$fh>);
+ close $fh;
+
$author = $1 if $author =~ /^(.+) <(?:unknown\@email.invalid|\S+\@users.noreply.github.com)>$/;
next if $author =~ /\[bot\]$/;
- $author =~ s/\.$//g;
$authors{$author} ||= 0;
- $authors{$author} += 1;
+ $authors{$author} += $committers{$committer};
}
my $author_file = catfile dirname($RealDir), 'docs', 'AUTHORS.txt';
diff --git a/tools/mkheaders b/tools/mkheaders
index 336615b67..d244f5cbc 100755
--- a/tools/mkheaders
+++ b/tools/mkheaders
@@ -33,10 +33,8 @@ use make::common;
use make::console;
my @ignored_revisions = (
- '0b4285abd12323920d92fee51e199edd7527dbec', # adding copyright headers
'46a39046196f55b52336e19662bb7bac85b731ac', # adding copyright headers
'4a6fedd9324d87349a806c9c1d0ae6e7d3c1fd38', # mass-updating descriptions
- '56375392ba94f2552bbeeeab4fd39e1e50295525', # sadie's name change
'bab14f0dd2345c9d7dcbc47c918563709e1ac094', # peavey breaking line endings
'de6d4dbd1e8845e08c2d87cd89a919e5b21ba619', # jsoref fixing a ton of typos
'f2acdbc3820f0f4f5ef76a0a64e73d2a320df91f', # peavey fixing line endings
@@ -123,7 +121,9 @@ for my $path (@paths) {
push @{$authors{$display}}, $commits{$commit}->{YEAR};
my $details = `git rev-list --format=%B --max-count=1 $commit`;
while ($details =~ /co-authored-by: ([^<]+<[^>]+>)/gi) {
- my $coauthor = $1;
+ open(my $fh, '-|', 'git', 'check-mailmap', $1);
+ chomp(my $coauthor = <$fh>);
+ close $fh;
my $year = $details =~ /co-authored-year: (\d+)/i ? $1 : $commits{$commit}->{YEAR};
$authors{$coauthor} //= [];
push @{$authors{$coauthor}}, $year;