Repository navigation
Fix .git_archival.txt version for tags like 2024-01-15 - #168
Merged
Merged
Conversation
Owner
|
Hi. Thank you for your contribution! |
dolfinus
approved these changes
Nov 11, 2026
Author
Thank you for reviewing and merging this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Summary
When the archived commit sits exactly on a tag,
describe-namein.git_archival.txtis just the tag name._parse_describe()doesrsplit("-", 2)and assumestag-N-gSHAas long as the middle piece is a number, so a date-style tag like2024-01-15comes out as tag2024with 1 commit on top.With the default templates:
Now the suffix is only stripped when it really looks like
-N-g<hex>; anything else is taken as the tag. Hyphenated tags with a real suffix (2024-01-15-3-g4060507) still parse the same way.Side effect: a suffix without the leading
g(v1.2.3-5-abc1234) is not split anymore.git describealways adds theg, so this shouldn't matter in practice.I added a few unit cases and an end-to-end test that tags a commit
2024-01-15and checks that the repo and the extracted archive give the same version.I only ran this on Windows with Python 3.14.
test_archival.pypasses. 16 other tests (test_substitution_timestamp,*_git_missing,*_git_not_executable) fail there with or without this change.Checklist
docs/changelog/next_release/<pull request or issue id>.<change type>.rstfile added describing change(see CONTRIBUTING.rst for details.)