Repository navigation
fix: ensure caret wildcard ^* matches any version as documented - #321
Closed
AdamMagued wants to merge 1 commit into
Closed
AdamMagued wants to merge 1 commit into
AdamMagued wants to merge 1 commit into
Conversation
The documentation for caret constraints specifies that ^* matches any version (^* --> (any)). However, parseConstraint normalizes wildcard segments to 0.0.0 while setting dirty = true and keeping minorDirty and patchDirty false. In constraintCaret, execution subsequently fell through to the patch-level equality check, restricting ^* to matching only 0.0.0. Add a check in constraintCaret for dirty version constraints with neither minor nor patch marked dirty (c.dirty && !c.minorDirty && !c.patchDirty) to match any version as documented, while preserving the existing exact ^0.0.0 behavior. Add regression test cases in constraints_test.go. Fixes Masterminds#317
Author
|
Closing in favor of earlier community PR #319 to avoid duplicate review effort. |
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.
Summary
The comment documenting caret constraint behavior in constraints.go specifies:
However, parseConstraint normalizes wildcard segments to 0.0.0 while marking dirty = true and leaving minorDirty and patchDirty as false. In constraintCaret, execution subsequently fell through to the patch-level equality check eq = c.con.Patch() == v.Patch(), restricting ^* (as well as ^x and ^X) to matching only 0.0.0.
Changes
Fixes #317