Skip to content

Commit

Permalink
Sort release tags *after* limiting
Browse files Browse the repository at this point in the history
`sortAscending = false` is not very useful unless one also sets
`numtagstodisplay = -1`, because the n releases *since inception*
instead of *since last release - 30* are displayed. This change
fixes that by sorting *only after* limiting results.
  • Loading branch information
salim-b committed Sep 19, 2023
1 parent 99f6e19 commit d95c43d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/hvm/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,18 @@ func (r *repository) fetchTags() error {
}
}

if Config.SortAscending {
semver.Sort(tagNames)
}

n := Config.NumTagsToDisplay
if n < 0 {
n = 9999
}
if n <= len(tagNames) {
tagNames = tagNames[len(tagNames)-n:]
}

if Config.SortAscending {
semver.Sort(tagNames)
}

r.tags = tagNames

return nil
Expand Down

0 comments on commit d95c43d

Please sign in to comment.