summaryrefslogtreecommitdiff
path: root/contrib/contacts/git-contacts
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2013-07-21 10:52:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-07-21 22:14:43 (GMT)
commit7c6d6ff8f122b10d6214c4f53e3179996dee2f9a (patch)
treec89ca59e3c989f3be925425d796ee625d2e9dd85 /contrib/contacts/git-contacts
parentccf6b45aff3f89016cf1a3e39a37e73e72c3e0f6 (diff)
downloadgit-7c6d6ff8f122b10d6214c4f53e3179996dee2f9a.zip
git-7c6d6ff8f122b10d6214c4f53e3179996dee2f9a.tar.gz
git-7c6d6ff8f122b10d6214c4f53e3179996dee2f9a.tar.bz2
contrib: contacts: add mailmap support
The purpose of git-contacts is to determine a list of people who might have some interest in a patch or set of changes. It can be used as git-send-email's --cc-cmd argument or the computed list might be used to ask for comments on a proposed change. As such, it is important to report up-to-date email addresses in the computed list rather than potentially outdated ones recorded with commits. Apply git's mailmap functionality to the retrieved contacts in order to achieve this goal. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/contacts/git-contacts')
-rwxr-xr-xcontrib/contacts/git-contacts18
1 files changed, 18 insertions, 0 deletions
diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts
index 4553add..d80f7d1 100755
--- a/contrib/contacts/git-contacts
+++ b/contrib/contacts/git-contacts
@@ -133,6 +133,23 @@ sub scan_rev_args {
close $f;
}
+sub mailmap_contacts {
+ my ($contacts) = @_;
+ my %mapped;
+ my $pid = open2 my $reader, my $writer, qw(git check-mailmap --stdin);
+ for my $contact (keys(%$contacts)) {
+ print $writer "$contact\n";
+ my $canonical = <$reader>;
+ chomp $canonical;
+ $mapped{$canonical} += $contacts->{$contact};
+ }
+ close $reader;
+ close $writer;
+ waitpid($pid, 0);
+ die "git-check-mailmap error: $?\n" if $?;
+ return \%mapped;
+}
+
if (!@ARGV) {
die "No input revisions or patch files\n";
}
@@ -161,6 +178,7 @@ for my $commit (values %commits) {
$contacts->{$contact}++;
}
}
+$contacts = mailmap_contacts($contacts);
my $ncommits = scalar(keys %commits);
for my $contact (keys %$contacts) {