Fix sorting of versions containing hyphens #221
Merged
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.
Pull Request Details
compareTo
for versions that have equal major, minor and patch versions and both contain a hyphenDescription
Assume that if all major, minor and patch versions are the same, a version with a hyphen is older than a version without one.
Related Issue
Fix #171
Motivation and Context
When two versions e.g.
0.9.5-alpha.3
and0.9.5-alpha.4
both contained a hyphen, thecompareTo
always returned-1
no matter which was left or right.This violates the
compareTo
contract, causing issues like #171.How Has This Been Tested
If I put the full changelog from here in the test then I reproduce #171. Unfortunately I did not manage to create a minimal test for this, but with this change for me the issue is fixed.
Types of changes
Checklist