Blame history for shallow clones is broken

We have a monorepo that can take a significant time to fully clone. This causes non trivial i/o and networking cost under AWS and pipelines that run on ephemeral containers so we use shallow clones in our pipelines to accelerate the cloning, which is a best practice recommended by GitHub.

Unfortunately once comes the time for Sonar to run, all the blame information that goes beyond the oldest commit in the shallow clone gets assigned to that commit. This causes sonar to claim that Bob owns the vast majority of the lines and issues tracked by SonarCloud.

To fix this we are forced to run git fetch --unshallow to download the entire git history once we reach the sonar stage of our CI pipeline. This is slow and should be unecessary, especially considering SonarCloud already has the true blame information from prior run, especially the main pipeline.

Adding proper support for shallow clones would save us runtime and networking cost on each CI pipeline run.

Thank you very much for your input, it is a valuable piece of insight.

I recorded this for consideration.

Denis

1 Like

I also have a similar issue. At my company we have started to use treeless clones, I would like to be able to disable the warnings from SonarQube. It’s should be flexible and work with best practices.