Skip to content

Commit

Permalink
Merge pull request #134 from krmichelos/master
Browse files Browse the repository at this point in the history
Fixing broken constraint checking with ^0.0
  • Loading branch information
mattfarina committed Nov 14, 2019
2 parents fe7c210 + 1b4e5a2 commit 61053f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,9 @@ func constraintCaret(v *Version, c *constraint) bool {
}

// ^ when the major is 0 and minor > 0 is >=0.y.z < 0.y+1
if c.con.Major() == 0 && v.Major() > 0 {
return false
}
// If the con Minor is > 0 it is not dirty
if c.con.Minor() > 0 || c.patchDirty {
return v.Minor() == c.con.Minor()
Expand Down
1 change: 1 addition & 0 deletions constraints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ func TestConstraintCheck(t *testing.T) {
{"^0.0.3", "0.0.4", false},
{"^0.0", "0.0.3", true},
{"^0.0", "0.1.4", false},
{"^0.0", "1.0.4", false},
{"^0", "0.2.3", true},
{"^0", "1.1.4", false},
{"^0.2.3-beta.2", "0.2.3-beta.4", true},
Expand Down

0 comments on commit 61053f7

Please sign in to comment.