Skip to content

Fix pre-release version comparison across versions with different non-canonical segments#2727

Closed
greysteil wants to merge 2 commits intoruby:masterfrom
greysteil:fix-prerelease-version-comparison
Closed

Fix pre-release version comparison across versions with different non-canonical segments#2727
greysteil wants to merge 2 commits intoruby:masterfrom
greysteil:fix-prerelease-version-comparison

Conversation

@greysteil
Copy link
Copy Markdown
Contributor

@greysteil greysteil commented Apr 14, 2019

Description:

Currently, the following happens:

Gem::Version.new("1.0.beta") >= Gem::Version.new("1.0.0.beta")
# => true
Gem::Version.new("1.0.beta") >= Gem::Version.new("1.0.0.alpha")
# => false

That is inconsistent. I propose that the second statement should be true. (Alternatively we could make the first statement false, but that is arguably a breaking change.)

Tasks:

  • Describe the problem / feature
  • Write tests
  • Write code to solve the problem
  • Get code review from coworkers / friends

I will abide by the code of conduct.

@greysteil greysteil changed the title Test demonstrating pre-release version comparison is broken Fix pre-release version comparison across versions with different non-canonical segments Apr 14, 2019
@deivid-rodriguez
Copy link
Copy Markdown
Contributor

@greysteil See #2651 😃

@greysteil
Copy link
Copy Markdown
Contributor Author

Ha! Make sense. I think the current situation is definitely a bug, and we should ship this as a bug fix. The case I put in the description of this PR isn't really defensible as a feature.

I'll close here and add a 👍 to #2651.

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.

3 participants