git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 4/5] contrib: contacts: add mailmap support

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jul 21, 2013, 10:52 UTC
Message-ID
<1374403962-48361-5-git-send-email-sunshine@sunshineco.com>
In-Reply-To
<1374403962-48361-1-git-send-email-sunshine@sunshineco.com>

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>
---
 contrib/contacts/git-contacts | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
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) {
-- 
1.8.3.3.803.gd114dc6
Previous: Eric SunshineNext: Eric Sunshine
Message 5 of 6 in “add git-contacts helper”
  1. 0/5 add git-contacts helperEric Sunshine, Jul 21, 2013
  2. 1/5 contrib: add git-contacts helperEric Sunshine, Jul 21, 2013
  3. 2/5 contrib: contacts: add ability to parse from committishEric Sunshine, Jul 21, 2013
  4. 3/5 contrib: contacts: interpret committish akin to format-patchEric Sunshine, Jul 21, 2013
  5. 4/5 contrib: contacts: add mailmap supportEric Sunshine, Jul 21, 2013
  6. 5/5 contrib: contacts: add documentationEric Sunshine, Jul 21, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.