Backport 16.9: Support multiple tags on a commit and Change tag sort order to desc
Backport of:
- Support multiple tags on a commit
We actually want to sort in descending order. The default is ascending.
The original fix from
!1375 (merged)
only worked because one of the commit was a release candidate with a
suffix, like this: v16.10.0
and v16.10.0-rc1
which in ascending
order does order v16.10.0
first.
See git-tag manpage
Test evidence
~/work/gitlab/gitlab-agent 16-9-stable*
❯ git tag --points-at HEAD 2>/dev/null
v16.9.3
v16.9.6
~/work/gitlab/gitlab-agent 16-9-stable*
❯ git tag --points-at HEAD 2>/dev/null | head -n 1
v16.9.3
~/work/gitlab/gitlab-agent 16-9-stable*
❯ git tag --points-at HEAD --list 'v*' --sort '-v:refname' 2>/dev/null
v16.9.6
v16.9.3
~/work/gitlab/gitlab-agent 16-9-stable*
❯ git tag --points-at HEAD --list 'v*' --sort '-v:refname' 2>/dev/null | head -n 1
v16.9.6
Limitations
The limitation here is that it would again sort wrong for suffix releases - however, this is just for this 16.9 branch for which we won't do any suffix releases.
Edited by Timo Furrer