Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScmVersion is wrong if two tags are on the same git-commit #1079

Open
jenisys opened this issue Oct 3, 2024 · 2 comments
Open

ScmVersion is wrong if two tags are on the same git-commit #1079

jenisys opened this issue Oct 3, 2024 · 2 comments

Comments

@jenisys
Copy link

jenisys commented Oct 3, 2024

If two tags are assigned to the same git-commit, setuptools-scm seems to get confused (especially if the secondary tag contains digits or ends with digits).

How to repeat

  • Use a python-project repository that uses setuptools-scm
# -- BASH SHELL (or similar):
$ git tag v1.2.3
$ python -msetuptools_scm
1.2.3
# OR: 1.2.4.dev0+gd... - If DIRTY

# -- CASE: Secondary tag with digits -- SYNDROME HERE
$ git tag BASELINE_D2024-10-03
$ python -msetuptools_scm
3

# -- CASE: Secondary tag without any digits -- OK
# CLEANUP: First remove last secondary tag.
$ git tag --delete BASELINE_D2024-10-03
$ git tag BASELINE
$ python -msetuptools_scm
1.2.3
# OR: 1.2.4.dev0+gd... - If DIRTY

RELATED:

@RonnyPfannschmidt
Copy link
Contributor

i think theres a need to fail very hard in that case, its nonsensical and confusin

@jenisys
Copy link
Author

jenisys commented Oct 3, 2024

RESOLVED:
Provide a specific git_describe_command in pyproject-toml to select the git-tag(s) that are of interest and exclude others that are not.

# -- FILE: pyproject.toml
# ...

# -- GIT-TAG MATCHER: Only use tags like: "v1.2.3"
[tool.setuptools_scm]
git_describe_command = "git describe --match 'v*'"

BUT: Documentation could be improved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants