Skip to content

Commit

Permalink
Do not select versions with a "smaller" pre-release identifier (#2367)
Browse files Browse the repository at this point in the history
Prevents PRs like VirtusLab/scala-cli#407.
  • Loading branch information
fthomas authored Nov 22, 2021
1 parent bc82cd0 commit a944e32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ final case class Version(value: String) {
// Do not select pre-releases of the same series if this is not a pre-release.
(v.isPreRelease && !isPreRelease && sameSeries) ||
// Do not select versions with pre-release identifiers whose order is smaller
// than the order of pre-release identifiers in this version. This, for example,
// prevents updates from 2.1.4.0-RC17 to 2.1.4.0-RC17+1-307f2f6c-SNAPSHOT.
((minAlphaOrder < 0) && (v.minAlphaOrder < minAlphaOrder)) ||
// than the order of possible pre-release identifiers in this version. This,
// for example, prevents updates from 2.1.4.0-RC17 to 2.1.4.0-RC17+1-307f2f6c-SNAPSHOT.
v.minAlphaOrder < minAlphaOrder ||
// Do not select versions that are identical up to the hashes.
v.alnumComponents === alnumComponents ||
// Do not select a version with hash if this version contains no hash.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class VersionTest extends DisciplineSuite {
Some("1.0.0-20201208-143052-2c1b1172")
),
("0.27.0-RC1", List("0.27.0-bin-20200826-2e58a66-NIGHTLY"), None),
("2.0.16-200-ge888c6dea", List("2.0.16-200-ge888c6dea-14-c067d59f0-SNAPSHOT"), None),
("17.0.0.1", List("18-ea+4"), None),
("", List("", ".", "1", "a"), Some("1"))
)
Expand Down

0 comments on commit a944e32

Please sign in to comment.