What is the behaviour of drone clone?

I having issues with Drone + Sonar + Github when the pull requests is opened, my PR don’t get the sonar analysis when the drone clone is enabled.

Searching about some case with issue, i found about it but the strategy behind clone is not clear.

I want understand how my pipeline works when clone is disabled, like this:

clone:
  disable: true

steps:
  - name: clone
    image: alpine/git
    commands:
      - git clone https://github.com/my-org/my-repo.git .
      - git fetch origin ${DRONE_SOURCE_BRANCH}
      - git checkout ${DRONE_SOURCE_BRANCH}

and run analysis:

sonar-scanner \
          -Dproject.settings=.sonarcloud.properties \
          -Dsonar.login=$SONAR_REGISTRATION_LOGIN \
          -Dsonar.qualitygate.wait=true \
          -Dsonar.pullrequest.base=${DRONE_TARGET_BRANCH} \
          -Dsonar.pullrequest.branch=${DRONE_SOURCE_BRANCH} \
          -Dsonar.pullrequest.key=${DRONE_PULL_REQUEST} \
          -Dsonar.pullrequest.provider=github

works:
image

but when try with image and checkout is via command not works

steps:
  - name: composer
    pull: if-not-exists
    image: my-project-image.url
    environment:
      COMPOSER_AUTH:
        from_secret: COMPOSER_AUTH
    commands:
      - git fetch origin ${DRONE_SOURCE_BRANCH}
      - git checkout ${DRONE_SOURCE_BRANCH}
      - ...

The second case, the PR analysis don’t get the difference between branches:

image

Some issues i founded:

Sorry, the discourse dont accept more than 2 links.