Pullrequest analysis warnings

Hi Team,

we are getting some warning messages(attached screenshot) when analyzing pullrequest. Please note that, we already have master branch analyzed, as our main branch is master. Can you please help us on this?

sonar.pullrequest.branch=$BRANCH_NAME sonar.pullrequest.key=96 sonar.pullrequest.base=master

CC: @ Olivier Korach


Hi @revant,

Please note that it’s not considered good etiquette on our forum to demand the attention of specific SonarSourcers. We provide our support here on a best-effort basis and we share the burden.

Your error is caused by having a shallow clone that doesn’t include the refs for your target branch (master in this case). Depending on the CI you use, you can fix this a few different ways.

  • Manually, with a command like git fetch --no-tags ${GIT_URL} +refs/heads/master:refs/remotes/origin/master
  • By instructing your CI to fetch refs during checkout (Jenkins has this option for multibranch pipeline projects)