Description
ReleasesCollection::sortByVersion() ranks alpha and beta pre-releases above the final release of the same version. Sorting v2024.1.0-alpha.1, v2024.1.0, v2024.1.0-beta.1, v2024.1.0-rc.1 gives:
v2024.1.0-beta.1
v2024.1.0-alpha.1
v2024.1.0
v2024.1.0-rc.1
Expected: v2024.1.0, v2024.1.0-rc.1, v2024.1.0-beta.1, v2024.1.0-alpha.1.
get-binary and download-protoc-binary install the first release of the sorted list that passes the stability filter. With --stability=beta (or lower) they pick the beta over the final release that is already out.
comparisonVersionString() replaces -<stability> with .<weight>.. v2024.1.0-beta.1 therefore compares as v2024.1.0.2..1, and version_compare() ranks it above v2024.1.0 because it has more numeric parts. Lower-case -rc tags are left untouched (the stability is RC), so they happen to sort correctly. Upper-case -RC tags have the same problem as beta and alpha. #2 was about the order among pre-releases.
Steps to reproduce
- Remove
#[Skip] from ReleasesCollectionTest::sortByVersionPutsPreReleasesBelowFinalRelease.
- Run
vendor/bin/testo --filter=sortByVersionPutsPreReleasesBelowFinalRelease.
Additional context
The release lookup may be replaced by DLoad in #49, in which case this code goes away.
Description
ReleasesCollection::sortByVersion()ranks alpha and beta pre-releases above the final release of the same version. Sortingv2024.1.0-alpha.1,v2024.1.0,v2024.1.0-beta.1,v2024.1.0-rc.1gives:Expected:
v2024.1.0,v2024.1.0-rc.1,v2024.1.0-beta.1,v2024.1.0-alpha.1.get-binaryanddownload-protoc-binaryinstall the first release of the sorted list that passes the stability filter. With--stability=beta(or lower) they pick the beta over the final release that is already out.comparisonVersionString()replaces-<stability>with.<weight>..v2024.1.0-beta.1therefore compares asv2024.1.0.2..1, andversion_compare()ranks it abovev2024.1.0because it has more numeric parts. Lower-case-rctags are left untouched (the stability isRC), so they happen to sort correctly. Upper-case-RCtags have the same problem as beta and alpha. #2 was about the order among pre-releases.Steps to reproduce
#[Skip]fromReleasesCollectionTest::sortByVersionPutsPreReleasesBelowFinalRelease.vendor/bin/testo --filter=sortByVersionPutsPreReleasesBelowFinalRelease.Additional context
The release lookup may be replaced by DLoad in #49, in which case this code goes away.