adamreeve / semver.net

Semantic versioning for .NET
MIT License
117 stars 22 forks source link

1.2.3 > 1.2 is false #38

Closed Alexejhero closed 5 years ago

Alexejhero commented 5 years ago

Exactly what the title says. Range.IsSatisfied(">1.2", "1.2.3") returns false instead of true

adamreeve commented 5 years ago

Hi, this is working as expected. 1.2 in a range specification is the same as 1.2.x so represents any patch version from 1.2.0 up to but excluding 1.3.0. 1.2.3 isn't greater than 1.2 because it is in the range of versions 1.2 represents. If you want a range that excludes 1.2.0 but includes 1.2.3 you need to specify the patch version explicitly, ie. >1.2.0.

This is the same behaviour as node-semver.

Alexejhero commented 5 years ago

Could this be circumvented in any way? I would have expected that setting loose to true would change this behaviour

adamreeve commented 5 years ago

No, loose just makes the version and range parsing more lenient but doesn't affect the range behaviour. Why do you want different behaviour? You could create versions and compare them rather than using the provided ranges of they don't work how you'd like.