Setup New code in the format “reference: develop”. Merged feature branch into the develop branch. Did not expect to see issues in new code that already had been committed to the develop branch one month earlier.
After analyzing logs it seems that SonarQube is using the correct commit to analyze but is using an old merge commit as reference. There had been around 10 merges from the branch into the reference branch since the commit used for reference.
Based on the way we pull the code its supposed to have a correct fresh clone. But it might be a problem in the way that the local Git client pulls the code since it seem to still refer to an early commit. I have noticed that our builds gives a warning about the client. Seems that we have a Jgit client used by our CI server, and the warning says its getting deprecated. I need to install another git client and see how that works.
Thanks for the advice about cloning process though. It might be that anyway. We have a setting in our builds that performs some caching. “Enable repository caching on agents”. I should probably try unchecking that one to start with. Although the text say that caches are always full clones in the text by the checkbox.
THis was a while ago, but to report the status, the issue was resolved by ensuring that the full git history was pulled from the git repo to the build server where the scan runs. There were a couple of checkboxes in the CI tool Bamboo that prevent a full git clone. By changing the config and ensuring that the full git repo with all branches was cloned, the new code function worked as it now could use the baseline branch approach.