Matching git-svn strange authors to useful email addresses

Ángel Ortega

Git-svn is a useful tool to communicate with a Subversion repository from git. You usually clone a repository with a command like:

git-svn clone svn+ssh://angel@svn.example.com/path/to/prj/trunk prj

And a prj directory is created with a full git repository. Then, you get another people changes with git-svn rebase and commit yours with git-svn dcommit.

It has one drawback, though; authors are mangled to something like

Author: angel <angel@2e99d34b-3c1d-0410-9ca7-923d03b5684e>

which is not only ugly but completely useless.

To map this monstrosity to real user email addresses and names, use the following steps:

First, create the file ~/.gitusers with content like this:

angel = Ángel Ortega <angel@triptico.com>
otheruser = Other User <ouser@example.net>

If you converted your SVN repository from CVS with something like cvs2svn you'll also find entries like this:

Author: (no author) <(no author)@2e99d34b-3c1d-0410-9ca7-923d03b5684e>

Those ones can be converted with another line in ~/.gitusers.

(no author) = Really Me <email@example.org>

And now, instead of the usual git-svn clone command, use the following ones:

mkdir prj
cd prj
git-svn init svn+ssh://angel@svn.example.com/path/to/prj/trunk
git config svn.authorsfile ~/.gitusers
git-svn fetch