Home > database >  Azure bash task not showing full git log output
Azure bash task not showing full git log output

Time:09-20

I have written a script to get the full git log between two commits and format it. But when running git log in an Azure Bash task it is only showing one commit.

- task: Bash@3
  inputs:
  targetType: 'inline'
  script: |
    lastTag="tag/${{ parameters.PreviousReleaseVersion }}"
    currentTag="tag/${{ parameters.ReleaseVersion }}"
    echo previous release: "$lastTag"
    echo next release: "$currentTag"
                
    git log --format='%H' $lastTag..$currentTag

Output:

 previous release: tag/2022....

 next release: tag/2022...

 a2ea57fea.. # rest of commit hash

Locally the script is working, and git log shows all commits.

CodePudding user response:

Torek provided the answer about the repo only being a shallow clone.

Adding git checkout -f master and git pull --rebase origin master before running git log solved the issue.

Or even better: git fetch --unshallow

  • Related