Skip to content

Generalize repository routing

Markus Koller requested to merge 207869-refactor-repository-routing into master

What does this MR do?

Part of #207869 (closed), extracted from !42863 (closed).

Previously we used both a :namespace_id and a :repository_id in the repository routes, which originally made sense for project repositories, but was confusing with personal snippets where :namespace_id was just the /snippets prefix and not an actual namespace.

For group wiki repositories we also need to support toplevel groups, where we only have a namespace path.

So we combine :namespace_id and :repository_id into a single :repository_path route argument, and refactor the related controllers and internal APIs accordingly.

The repository path is mainly used in Gitlab::RepoPath to determine the container for the repository. In the GitAccess classes it's only used in GitAccessProject when auto-creating project repositories, where we need to know in which namespace to create the new project.

This needs to be merged after !45874 (merged), and is in preparation for !45892 (merged).

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Dominic Couture

Merge request reports

Loading