Port branch sorting mechanism to FindAllTags
In internal/gitaly/service/ref/refs.go
there's support for a few sorting options on FindLocalBranches
, which allow sorting the branch refs by refname
, committerdate
, and -committerdate
. This is implemented in the parseSortKey
function.
It'd be very useful to have this ability generalised to work on the tags methods too. FindAllTags
does currently support pagination, I believe, but it doesn't support sorting - currently this means that the Rails app loads in the full set of tags and sorts it in Ruby instead, which is a) slow, and b) prevents us using the pagination feature of this RPC.
This would contribute to the "proper" solution to gitlab#299529 (closed), which is currently a cause of excessive Gitaly load.
I've investigated what needs doing on the Rails side and the changes aren't especially difficult, but without the sorting mechanism we'd only be able to use the pagination feature if we change the API to remove the sorting options. By default it sorts by updated_desc
which would be -committerdate
in Gitaly.