Skip to content

Commit

Permalink
Add contrib/stats/mailmap.pl script
Browse files Browse the repository at this point in the history
This script reads the existing commit log and .mailmap file,
and outputs author e-mail addresses that would map to more
than one names (most likely due to difference in the way they
are spelled, but some are due to ancient botched commits).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Jul 14, 2007
1 parent 9d6f220 commit af6861b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions contrib/stats/mailmap.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/perl -w
my %mailmap = ();
open I, "<", ".mailmap";
while (<I>) {
chomp;
next if /^#/;
if (my ($author, $mail) = /^(.*?)\s+<(.+)>$/) {
$mailmap{$mail} = $author;
}
}
close I;
my %mail2author = ();
open I, "git log --pretty='format:%ae %an' |";
while (<I>) {
chomp;
my ($mail, $author) = split(/\t/, $_);
next if exists $mailmap{$mail};
$mail2author{$mail} ||= {};
$mail2author{$mail}{$author} ||= 0;
$mail2author{$mail}{$author}++;
}
close I;
while (my ($mail, $authorcount) = each %mail2author) {
# %$authorcount is ($author => $count);
# sort and show the names from the most frequent ones.
my @names = (map { $_->[0] }
sort { $b->[1] <=> $a->[1] }
map { [$_, $authorcount->{$_}] }
keys %$authorcount);
if (1 < @names) {
for (@names) {
print "$_ <$mail>\n";
}
}
}

0 comments on commit af6861b

Please sign in to comment.