snoyberg / githash

Compile git revision info into Haskell projects
BSD 3-Clause "New" or "Revised" License
33 stars 12 forks source link

giDescribe: always include the git revision / tests fix / bump version #21

Closed simonmichael closed 3 years ago

simonmichael commented 3 years ago

Add git describe's --long flag to ensure that a git revision hash is always shown (--always isn't enough). Eg when tag "1.21" is checked out, show "1.21-0-g7690b85e5", not just "1.21".

I want to always show the git revision in --version output, including for released versions. Hopefully others do as well, so that hard coding this is ok.

Unfortunately I don't know which git versions support --long, but githash doesn't discuss git version and I'm guessing the flag has been around a long time, so I haven't looked further.

Thanks for githash!

simonmichael commented 3 years ago

PS in my git version (2.30.2) there are two other flags which might be of interest. I thought about adding them but didn't; just FYI:

`--dirty': If the working tree has local modification "-dirty" is appended to it. If a repository is corrupt and Git cannot determine if there is local modification, Git will error out, unless `--broken' is given, which appends the suffix "-broken" instead.

simonmichael commented 3 years ago

Correction: just the --broken flag would be needed; it adds "-dirty" when there are uncommitted changes or "-broken" when the repo is somehow corrupt.

snoyberg commented 3 years ago

LGTM. Can you add a minor version bump and changelog entry explaining the change? Thanks!

simonmichael commented 3 years ago

Done, and a fix making tests more robust.

snoyberg commented 3 years ago

Thanks!