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

Differentiate on metadata #58

Closed
wants to merge 1 commit into from
Closed

Conversation

pselle
Copy link

@pselle pselle commented Jun 5, 2019

Differentiate on metadata, addresses #56

In prior behavior, this library would say that versions 1.0+abc and 1.0+def are equal, which can be an issue when checking which version should be used, such as in hashicorp/terraform#20814

An open question here is if this library means to say that 1.0+abc and 1.0+def are equivalent -- I am inclined to say not, but I am interested in prior decisions/data on this.

This PR repurposes comparePrereleases to check metadata (not just pre-release), and since that function does its own equality check, removes some of the pre-comparisons that were made (ex. checking if prerelease was "" before calling this compare). comparePrereleases and what it calls, comparePart, do the work of comparing strings for 1/0/-1.

Open to discussion on what user expected behavior is here!

@pselle
Copy link
Author

pselle commented Jun 6, 2019

According to the semver spec, https://semver.org/#spec-item-10

Build metadata SHOULD be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85.

Thus, the existing behavior (as far as ordering goes) follows spec, so I'm closing this PR, but will look into this further.

@pselle pselle closed this Jun 6, 2019
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.

None yet

1 participant