Skip to content

Use Wiki instance as repository container

Markus Koller requested to merge use-wiki-as-repository-container into master

What does this MR do?

Before we started working on group wikis, ProjectWiki used a Project instance as the container of its Repository instance, so for group wikis we did the same with Group.

This initially made sense and also mostly aligned with the semantics for Repository#container, but while working on wiki diffing [1] we noticed that the Commit and Blob classes sometimes use container#repository, which breaks some assumptions and also causes redundant Gitaly calls to the project repository when diffing wikis.

Refactoring those classes is a lot riskier and would affect other features too, so in this commit we're instead changing the Repository#container to be the wiki instance, rather than the project or group. This generally seems to make sense anyway, and only needs some small adjustments.

To satisfy the interface for Repository#container, we need to add or tweak some methods:

  • Wiki.find_by_id
  • Wiki#id
  • Wiki#to_global_id

We also still need to be able to resolve wiki repositories from their containers, this is handled in the repository resolver for Gitlab::GlRepository::WIKI.

[1] !35330 (merged)

Some of this was also discussed in #219069, although that issue was originally about renaming Wiki#container to something else, to avoid confusion with Repository#container (which I think would still make sense, but it's out of scope for this MR).

This also doesn't address #217752 yet, which mostly involves renaming project to container in the diff classes.

Screenshots

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 Markus Koller

Merge request reports