GitVersion task fails on a cloned Azure DevOps YAML Pipeline

Problem

I recently had a strange problem. I had an existing Azure DevOps YAML Pipeline that used the checkout task to do a deep Git fetch of a repo and it's submodules. The reason for the deep fetch was that later in the pipeline we ran GitVersion and this needs the whole repo to be able to calculate the version.

 1- checkout: self
 2        persistCredentials: true
 3        submodules: true
 4
 5- task: gitversion/setup@0
 6    displayName: 'Get current version of GitVersion'
 7    inputs:
 8    versionSpec: '5.x'
 9
10- task: gitversion/execute@0
11    displayName: 'Run GitVersion to generate SEMVER'
12    inputs:
13    useConfigFile: true
14    configFilePath: '$(System.DefaultWorkingDirectory)/GitVersion.yml'

On this original pipeline this was all working as expected.

However, when I created a second Azure DevOps pipeline that pointed to the same YAML file, expecting it to work without issues, it failed at the GitVersion task. It could not calculate the version.

On checking the pipeline logs, I could see that the git checkout had used a depth of 1 i.e. a shallow fetch, more efficient, but not providing all the branch and commit information GitVersion needs

The fix

It seems that on this 2nd pipeline the UX based pipeline settings were set differently, overriding the YAML ones, so causing a shallow fetch to be used.

ScreenShot

When I switched off the UX 'set shallow fetch' all worked as expected [accessed via Pipeline > Edit > Ellipsis menu > Triggers > YAML tab]

Confusing that a cloned pipeline should end up with different settings, especially when the setting you need to change is far from easily discoverable