[go: up one dir, main page]

Skip to content

Remove pagination from recursive form of /projects/:id/repository/tree REST API endpoint

Description

To avoid CORS issues in the VS Code Web IDE, we need to move the endpoint which retrieves the file list from an internal controller call to a standard REST API call.

The /projects/:id/repository/tree endpoint will work, but we need to avoid pagination in order for it to be performant enough to retrieve the entire file tree during Web IDE load.

So, we will remove pagination from this endpoint ONLY if the recursive parameter is set to true.

There are no performance concerns with removing pagination in the non-recursive case, because in this case, Gitaly always retrieves the entire tree via git ls-tree, regardless of whether pagination is used or not.

The non-paginated case uses a different approach than git ls-tree, so we need to preserve pagination behavior in that case.

See more details in this discussion thread: #355019 (comment 1020800985)

See also related discussion in slack thread: https://gitlab.slack.com/archives/CB3LSMEJV/p1657667442291659

Not in the scope of this issue

The following items which were discussed in this comment will NOT be done as part of this issue. Follow-up issues can be created to address them:

  1. Add a blobs_only boolean parameter (will save ~17% of request payload size in the case of GitLab repo). This would require us to omit the -t (tree entries) option from the Gitaly ls-files call. Follow-up issue created: Add a blobs_only boolean parameter /projects/:i... (#368642 - closed)
  2. Add filesize to response payload, since it is easy to obtain via the -l option to the Gitaly ls-files call. Follow-up issue created: Add filesize to response payload of /projects/:... (#368643)

Related Issues/MRs

This issue will be implemented in the following MR:

The following issues and MRs will be closed in favor of this issue:

Edited by Chad Woolley