Skip to content

Fix issue where v0.9.0 was considered a higher version than v1.0.0 - #348

Merged
satishskamath merged 1 commit into
EESSI:mainfrom
casparvl:fix_latest_version_in_period_runs
Aug 3, 2026
Merged

satishskamath merged 1 commit into
EESSI:mainfrom
casparvl:fix_latest_version_in_period_runs

Conversation

@casparvl

@casparvl casparvl commented Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator

Sort order with the original:

$ git tag | grep '^v[0-9]\+\.[0-9]\+\.[0-9]\+$' | sort -t. -k 1,1n -k 2,2n -k 3,3n
v1.0.0
v0.1.0
v0.2.0
v0.3.0
v0.3.1
v0.3.2
v0.4.0
v0.5.0
v0.5.1
v0.5.2
v0.6.0
v0.7.0
v0.7.1
v0.8.0
v0.8.1
v0.9.0

The issue is that sort is seeing v0 and v1 as a single entity, which, numerically, are both considered 0. It then looks to the second field for sorting, hence v1.0.0 is considered lower.

Sort order after this change:

$ git tag --list 'v*' | sort -V
v0.1.0
v0.2.0
v0.3.0
v0.3.1
v0.3.2
v0.4.0
v0.5.0
v0.5.1
v0.5.2
v0.6.0
v0.7.0
v0.7.1
v0.8.0
v0.8.1
v0.9.0
v1.0.0

sort -V is "natural sort of (version) numbers within text" according to the manual :)

@satishskamath
satishskamath self-requested a review August 3, 2026 15:53
@satishskamath

Copy link
Copy Markdown
Collaborator

Checked the tag code on a random repo:

git tag --list 'v*' | sort -V | tail -n5
v1.0.0-beta.2
v1.0.0-beta.3
v1.0.0-beta.4
v1.1.0
v1.2.0

Works as expected.
LGTM!

@satishskamath
satishskamath merged commit 81f13bf into EESSI:main Aug 3, 2026
16 checks passed
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.

2 participants