Add sort capability for GetTreeEntries
The GitLab frontend first makes a GetTreeEntries
request to get a list
of all entries in the repository directory, and then it follows up with
a ListLastCommitsForTree
request to fill in the last commit for each
entry.
If we paginate the GetTreeEntries
RPC, we need to make sure that the
pagination matches the list returned by ListLastCommitsForTree
. To do
this, we introduce a sort parameter in the GetTreeEntries
that will
optionally return the entries, sorted by trees, blobs, and submodules.
Note that GetTreeEntries
and ListLastCommitsForTree
could possibly
be refactored to share the git ls-tree
parsing, but they currently
have their own implementations. Also if recursive
is used, the entries
will be sorted with trees first, but this should be okay since the
frontend doesn't request a recursive list for either RPC.
Relates to #3700 (closed)