git-codereview: allow short user names in git mail
In Mercurial, hg mail expanded Rietveld user names.
There are no Gerrit user names.
There are GitHub user names, but then I'd have to type
instead of khr,gri,r,iant.
The algorithm for expanding short user names is as follows:
Look at the git commit log for the current repository,
extracting all the email addresses in Reviewed-By lines
and sorting by how many times each address appears.
For each short user name, walk the list, most common
address first, and use the first address found that has
the short user name on the left side of the @.
This is a purely local operation, it adjusts automatically as
new reviewers come on board, it avoids a separate database,
it adjusts to repo-specific reviewer patterns, and it resolves
potential ambiguity in favor of the most common reviewers.
(For example, firstname.lastname@example.org will beat any other email@example.com
in the main repo.)
Reviewed-by: Brad Fitzpatrick <firstname.lastname@example.org>
Reviewed-by: Josh Bleecher Snyder <email@example.com>
Reviewed-by: Austin Clements <firstname.lastname@example.org>
Reviewed-by: Andrew Gerrand <email@example.com>
4 files changed