Git mailmap
I’m reading Working effectively with legacy code now. The definition of legacy in this book is pretty straightforward: “is it code without tests”. Completely agree, an effective team can generate legacy out of new project in a couple of weeks. Unless they are following TDD ;)
There is another interesting book though: Code as a Crime Scene (link). I haven’t read it, but I’ve listened for its author talking about it. The idea is to use Version Control System (git) to highlight “hot spots”, places that are changed more often compared to other parts of a project. This information should tell us which parts need more care and which can be left along (and which could be removed completely). Armed with this information we can target refactoring with a high precision. And don’t spend precious time on refactoring of non-important parts.
The author of that book build a company based on that idea, but before that he build this code-maat. It is a tool to do repo analysis and provide meaningful insights. A nice tool, yet it is written in Clojure and not maintained. Well, all new features are part of the paid product, so that makes sense.
The very first problem I faced using this tool was chaos in my repo with author names and emails. Apart from some commits created by user “root”, many people used different names and emails. And that made analysis that includes authors much less useful.
This is how I got familiar with .mailmap. This feature of git allows mapping all possible options of name+email to the one and only. Just list desired option followed by all others in the same line per person and all git command will return only valid name and email. Yet this file has to be stored in the repo root.