Skip to content

Make GlRepository the single source of truth for initialising Repository

James Fargher requested to merge ssot_repository into master

What does this MR do?

This MR aims to begin centralising initialisation of ::Repository throughout gitlab.

There are a growing number of repository types. The high level git repository interface is ::Repository. The problem is that this class takes a large number of arguments, it is difficult to verify that it is working correctly, we often want to operate on all repo types of a container (e.g. Project, Group, Snippet) and it is increasingly difficult to create new repository types as the number places that need modifying increases.

Here we cover the default basic case, access the current repository. There are several other use-cases that mean we have to manually create either ::Repository or Gitlab::Git::Repository (aka ::Repository#raw). These cases are usually copy/move/delete operations where we want to operate on the previous or new git repository (as opposed to the current git repository). Because of these cases it seems easier to centralise on Gitlab::GlRepository rather than allowing extra arguments on each container type (Project, Group, Snippet) repository accessor.

Example cases that I want to cover with future refactoring:

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 James Fargher

Merge request reports