chocolatey / Chocolatey.Cake.Recipe

A set of convention based Cake scripts for building Chocolatey projects
Apache License 2.0
5 stars 9 forks source link

Support building when in a detached head state #151

Closed corbob closed 1 month ago

corbob commented 1 month ago

Checklist

Is Your Feature Request Related To A Problem? Please describe.

Recently I had a need to run a git bisect on a repository to try and track down an issue. In doing so, I found that I was unable to successfully run the build script without creating an interim branch as GitVersion would not generate a version number due to being in a detached head state.

Describe The Solution. Why is it needed?

If we can detect being in a detached head state (or if GitVersion doesn't generate a version for other reasons), we should perhaps generate a known dummy version number so the build can proceed.

Additional Context

Not sure if it matters, but when I choco install gitversion.portable and run gitversion while in a detached head state, it generates a version number successfully, so this might be a matter of using a newer version of gitversion? Or perhaps parsing the output better? Not entirely sure, I haven't investigated beyond knowing it doesn't build.

Related Issues

No response

corbob commented 1 month ago

I've found that I can build with --ShouldRunGitVersion=false and it will just generate a dumby version. This is sufficient for my use cases. Will close this and we can reopen if we decide we want to do something different.