RepoSense
RepoSense copied to clipboard
Option to merge/map git-users
What feature(s) would you like to see in RepoSense?
It would be quite useful to merge/map git-users of same origin to one user.
Is the feature request related to a problem?
Problem: the "same" (git-)user commits into the repo with different usernames like
Simon tester (tester)
simon (tester)
If possible, describe the solution
You could bring in an option to merge/map git usernames into one user.
@christophhalbi Indeed, authors using different git usernames is a problem. The current remedy is to specify those different git usernames in the Author's Git Author Name
of the author-config.csv https://reposense.org/ug/configFiles.html#author-config-csv after which RepoSense will consider all of them as one author and merge their activities together.
Is that along the lines of what you had in mind?
@damithc Thx! That looks great, I'll have a look.
I will be looking into this.
I've tried looking into the issue, but I'm not exactly sure what the problem is. It is possible that I missed out on something.
When I specify multiple Author's Git Author Name
in the author-config.csv
, it manages to merge them together into one author, so that method already works.
Is the issue then merging users when author-config.csv
is not specified? In that case, GitShortlog.getAuthors(config)
will be called instead, which means that git host id and display name will be the same.
Is the issue then merging users when
author-config.csv
is not specified?
@lawwm Yes, the proposed feature is an alternative (or can be complementary) to the current way of specifying multiple author names.
GitShortlog.getAuthors(config)
is used to get author names, which runs git log --pretty=short | git shortlog --summary
to get git usernames. An email flag --email
can be added to git shortlog
to include git email.
Maybe different usernames can be mapped to the same email? However, I'm not sure if it would be a useful feature?
Currently, git has a nifty feature called mailmap. By specifying a .mailmap
file in the top level of the repository, it allows a user to map author/commiter names and/or e-mail addresses.
After some investigation, it seems this feature already innately works, and no modification of RepoSense backend is required. It also seems to have priority over any mappings done by author-config.csv
. I think that we can add some documentation about the option to use git's mailmap feature and close this issue.
Before
2 seperate authors, "Marcus" and "Marcus Tang"
After adding .mailmap
file
.mailmap mapping "Marcus" to "Marcus Tang":
Marcus Tang <[email protected]> Marcus <[email protected]>
Thanks for the investigation. That's really interesting. Maybe under this section of the UG https://reposense.org/ug/customizingReports.html#get-target-repos-to-provide-more-info