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

Fix handling of single digit tilde constraint #51

Merged
merged 1 commit into from
May 2, 2017

Conversation

dgodd
Copy link
Contributor

@dgodd dgodd commented Apr 12, 2017

"~2" was documented to work, but did not

"~2" was documented to work, but did not
@dgodd dgodd changed the title Fix handling of signle digit tilde constraint Fix handling of single digit tilde constraint Apr 12, 2017
dgodd added a commit to dgodd/nodejs-buildpack that referenced this pull request Apr 12, 2017
@mattfarina
Copy link
Member

@dgodd good catch. I'll get on this in the next few days. Thanks.

@mattfarina
Copy link
Member

To call it out, the specific doc says..

~1 is equivalent to >= 1, < 2

In this case it basically acts like ^.

These rules are confusing... and I wrote that.

I can confirm the current implementation doesn't work for this rule. I'm going to research what others do here before I merge this.

@mattfarina
Copy link
Member

NPM (node.js) does:

~1.2 := >=1.2.0 <1.(2+1).0 := >=1.2.0 <1.3.0 (Same as 1.2.x)
~1 := >=1.0.0 <(1+1).0.0 := >=1.0.0 <2.0.0 (Same as 1.x)

Cargo (rust) does:

~1.2.3 := >=1.2.3 <1.3.0
~1.2 := >=1.2.0 <1.3.0
~1 := >=1.0.0 <2.0.0

@@ -175,7 +175,7 @@ func parseConstraint(c string) (*constraint, error) {
if isX(m[3]) {
ver = "0.0.0"
dirty = true
} else if isX(strings.TrimPrefix(m[4], ".")) {
} else if isX(strings.TrimPrefix(m[4], ".")) || m[4] == "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note (for my future self): what this does it treat a missing minor element as x instead of 0.

@mattfarina mattfarina merged commit d1c4c64 into Masterminds:master May 2, 2017
@mattfarina
Copy link
Member

@dgodd Thanks for the contribution

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

Successfully merging this pull request may close these issues.

2 participants