I am getting strange results with Azure CLI Git checkout
I've tried adding the folloing to my pipeline.
checkout: self (to try force an exclusive checkout in case this was a problem)
clean: true
fetchDepth: 1
Basically, I have a pipeline job which requires the previous commit (which always is the HEAD) to be acknowledged as the previous HEAD. (The smarts in my program does something which compares file changes between two commits to work out what to deploy to a mainframe). The branch in question is the default branch too...
What is happening though, is that Azure sometimes does a rogue identification of the previous HEAD during checkout to other commits (not the latest). There is no rhyme or reason to this either (random commits). I'm thinking it might be previous info. I've also tried adding a workspace clean step, but then it has NO history / incremental history at all (and blows up my pipeline as attempts to deploy everything as the comparisons don't match).
Example output:
remote: Azure Repos
remote:
remote: Found 0 objects to send. (4 ms)
From https://dev.azure.com/example/team/_git/myrepo
branch b03a543a15e3799a01945fd8f31089ad1d9990ce -> FETCH_HEAD
git checkout --progress --force refs/remotes/origin/b03a543a15e3799a01945fd8f31089ad1d9990ce
Previous HEAD position was 2bc6ee1553 Trying a deploy again <--------- THIS IS THE PROBLEM, this is 10 commits back and not the previous HEAD
HEAD is now at b03a543a15 Trying to remove the clean now, it's all about the checkout
Finishing: Checkout`
Is there a way to always ensure with checkout, the identified previous head is the last commit prior to the pipeline run?
Thank you.
Checkout process in Azure / Git is always the correct last commit as the previous HEAD.