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, will beat any other
in the main repo.)

Change-Id: I53afea2a86ba4cfa8fd7f31d56b90a3e12cc2b48
Reviewed-by: Brad Fitzpatrick <>
Reviewed-by: Josh Bleecher Snyder <>
Reviewed-by: Austin Clements <>
Reviewed-by: Andrew Gerrand <>
4 files changed
tree: bc495c2ed5f37bd4a80c52a8e99e1412038f3164
  1. .gitattributes
  3. git-codereview/