setuptools-scm: The documented `.git_archival.txt` causes git archives to change hash after first post-release commit is made

The documentation suggests using the following content for the .git_archival.txt file:

node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$

This means that if a tag is created on top of the main branch, the file initially contains e.g.:

ref-names: HEAD -> main, tag: v1

but once another commit is added and main no longer corresponds to the tag, it changes to:

ref-names: tag: v1

This causes the git archive hash to change. This is a problem for distributions like Gentoo that are using git archives generated by GitHub. The initial archive that we fetch once the release is made changes once upstream makes new commits.

See e.g.: https://bugs.gentoo.org/895910, https://bugs.gentoo.org/895712

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 16 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Isn’t the need for ref-names obsoleted by the availability of the describe-name I added to current versions of git (and which is specifically designed to be stable, at least if abbrev is used)?

Maybe the template recommendation can simply phase out the old and unreliable ref-names formatter?