Choose a semver tag over the last tag in a repo - #3732
Closed
pjaselin wants to merge 5 commits into
Closed
Conversation
… of tags assoicated with that commit before selecting a tag
Choose a git tag with a period when running autoupdate
pjaselin
commented
Aug 2, 2026
Author
There was a problem hiding this comment.
Does NO_FS_MONITOR need to be in L240?
Member
|
search the issue tracker next time |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem: I'm (and it looks like others) are seeing this pop up with pre-commit hooks coming from repos like: https://github.com/crate-ci/typos where a tag like "v1" is maintained for the latest release along with a semver tag like "v1.Y.Z". When running
pre-commit autoupdate, you always get the "v1" tag instead of the latest "v1.Y.Z" tag. This is reported with a workaround here: crate-ci/typos#390 but it seems like the fix should actually be at the pre-commit level and not to go around mirroring repos to get a clean set of tags.Solution: I believe the intention of the git.get_best_candidate_tag function is to choose a semver-compliant tag instead of necessarily the most recent one, where these tags may be off the same commit SHA. This PR gets the commit for the last found tag, then gets all tags associated with that commit SHA, and finally allows for returning that commit if there's a period in it. I've added tests for the git and autoupdate module to support the changes.
Edit: I'm reading your comments in #2366 and I'm seeing how there's a tradeoff between repeatability here in getting the right tags so this might not be an improvement even if it appears to fix what I've experienced. Happy to close this if so and take it as an opportunity to learn about the internals of pre-commit.