Use 0~git.<commit-count>.<hash> so tagless snapshots sort in ancestry
order and accept hashes beginning with a letter. A shallow checkout
without a reachable tag must supply a version rather than compare
unreliable history depths. Preserve explicit and tag-derived versions.
When no tag range produces entries, emit the history at the requested
ref instead of an empty changelog. Keep the newest tag across empty
ranges so co-located tags and explicit versions at HEAD retain their
requested package version.
Resolve the selected revision before printing any entries; a repository
without a usable revision must fail rather than emit a malformed header.