Generalize repository routing
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
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
-
Tested locally: Cloning of all supported repository types ( Project
,ProjectWiki
,ProjectSnippet
,PersonalSnippet
) through both SSH and HTTP
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