Skip to content

Commit 61053f7

Browse files
authored
Merge pull request #134 from krmichelos/master
Fixing broken constraint checking with ^0.0
2 parents fe7c210 + 1b4e5a2 commit 61053f7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

constraints.go

+3
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ func constraintCaret(v *Version, c *constraint) bool {
493493
}
494494

495495
// ^ when the major is 0 and minor > 0 is >=0.y.z < 0.y+1
496+
if c.con.Major() == 0 && v.Major() > 0 {
497+
return false
498+
}
496499
// If the con Minor is > 0 it is not dirty
497500
if c.con.Minor() > 0 || c.patchDirty {
498501
return v.Minor() == c.con.Minor()

constraints_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ func TestConstraintCheck(t *testing.T) {
171171
{"^0.0.3", "0.0.4", false},
172172
{"^0.0", "0.0.3", true},
173173
{"^0.0", "0.1.4", false},
174+
{"^0.0", "1.0.4", false},
174175
{"^0", "0.2.3", true},
175176
{"^0", "1.1.4", false},
176177
{"^0.2.3-beta.2", "0.2.3-beta.4", true},

0 commit comments

Comments
 (0)