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

fix: use versionsort.suffix to sort pre release versions before release #14

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

MontakOleg
Copy link
Contributor

Currently mise ls-remote tuist sorts -beta versions after release version:

3.42.1
3.42.2
4.0.0
4.0.0-beta-1
4.0.0-beta.2
4.0.0-beta.3
4.0.0-beta.4
4.1.0

We can use git config versionsort.suffix to fix this behavior. From man git-config:

>versionsort.suffix
           Even when version sort is used in git-tag(1), tagnames with the same base version but different suffixes are still sorted lexicographically,
           resulting e.g. in prerelease tags appearing after the main release (e.g. "1.0-rc1" after "1.0"). This variable can be specified to determine the
           sorting order of tags with different suffixes.

           By specifying a single suffix in this variable, any tagname containing that suffix will appear before the corresponding main release. E.g. if the
           variable is set to "-rc", then all "1.0-rcX" tags will appear before "1.0". If specified multiple times, once per suffix, then the order of
           suffixes in the configuration will determine the sorting order of tagnames with those suffixes. E.g. if "-pre" appears before "-rc" in the
           configuration, then all "1.0-preX" tags will be listed before any "1.0-rcX" tags. The placement of the main release tag relative to tags with
           various suffixes can be determined by specifying the empty suffix among those other suffixes. E.g. if the suffixes "-rc", "", "-ck" and "-bfs"
           appear in the configuration in this order, then all "v4.8-rcX" tags are listed first, followed by "v4.8", then "v4.8-ckX" and finally "v4.8-bfsX".

           If more than one suffixes match the same tagname, then that tagname will be sorted according to the suffix which starts at the earliest position in
           the tagname. If more than one different matching suffixes start at that earliest position, then that tagname will be sorted according to the
           longest of those suffixes. The sorting order between different suffixes is undefined if they are in multiple config files.

After changes it will look like this:

3.42.1
3.42.2
4.0.0-beta-1
4.0.0-beta.2
4.0.0-beta.3
4.0.0-beta.4
4.0.0
4.1.0

Original discussion in slack: https://tuistapp.slack.com/archives/CCXC295QS/p1707746179744519

Old order:

3.42.1
3.42.2
4.0.0
4.0.0-beta-1
4.0.0-beta.2
4.0.0-beta.3
4.0.0-beta.4
4.1.0

New order:

3.42.1
3.42.2
4.0.0-beta-1
4.0.0-beta.2
4.0.0-beta.3
4.0.0-beta.4
4.0.0
4.1.0
@MontakOleg MontakOleg requested a review from a team as a code owner February 13, 2024 16:29
@MontakOleg MontakOleg changed the title Use versionsort.suffix to sort pre release versions before release fix: use versionsort.suffix to sort pre release versions before release Feb 13, 2024
@pepicrft pepicrft merged commit bffa4c9 into asdf-community:main Feb 13, 2024
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants