When using Git, blame shows ‘committer’ and not ‘author’
- ALM used: GitHub
- CI system used: Github Actions (but not configured yet with our project)
- Languages of the repository: Ruby, JS/TS
- Only if the SonarCloud project is public, the URL: Not public, but happy to provide any necessary details privately
Steps to reproduce
Let me know if these steps don’t work and I’ll try to help. I am trying to make them as specific as possible.
Suppose you have two users, call them “Orion” and “Devin”.
As Orion, make two non-empty commits, to the main branch. Each commit writing to a separate file (we’re going to reorder these commits, so we don’t want merge conflicts).
Then push the branch upstream.
As Devin (from here on), pull latest changes from that branch
While at the HEAD of that branch, do an interactive rebase to swap the ordering of Orion’s two commits. This can be done from the terminal as follows:
git rebase -i HEAD~2.
- Reorder the two commits in the editor by cutting and pasting line 1 to go below line 2.
- Save the temporary file and the two commits will be in a different order.
Then push the branch upstream with a force push.
git push -f <branch name>.
Devin will be the committer, Orion will be the author. SonarCloud shows the commiter and not the author as the blame result for each line. This is incorrect and probably a result of JGit’s implementation.
None, except perhaps switching to SonarQube which isn’t an option for us
I think this is a big problem and it certainly keeps SonarCloud from being usable for us as a tool. The blame information is critically important as it can help with assigning remediation work and many of SonarCloud’s features use the blame information to provide context.
My best outsider’s guess on a potential solution would be for you to implement ‘native git’ in SonarCloud as it was done for SonarQube. [SONAR-16290] - Jira
Hopefully there’s an easier way to fix this, it is a potential show stopper.