Skip to content

WIP: Remove the Blob#container abstraction

Nick Thomas requested to merge remove-blob-container into master

What does this MR do?

This is another incremental bite at #201886 (closed)

Blobs do not necessarily have a project. Personal snippets and group wikis have repositories, with blobs, that are not part of any project.

The "container" abstraction was introduced to hide this difference, but it proves difficult to use well. Since the contexts that want to use ::Blob typically already know what the container is, we can get cleaner code by removing the ability to look up a project/container from the blob itself.

In the interests of making this an incremental bite, if the number of places calling Blob#container and Blob#project is too high, I'll restore those as methods delegated to the repository, but I want to see how the pipeline looks first.

Two concerns within ::Blob still used project. Those were reading through an LFS pointer in cases where LFS is enabled; and (in EE) Blob#owners. The former, I pushed out to the Repository for now - it's just a transitional state. The latter was a simple indirection only used in one place, so I removed it entirely.

There are a number of other Blob-like classes hanging around - ReadmeBlob, FoundBlob, etc. These don't need to follow the same calling conventions as ::Blob, but where it was quick and simple, I made it match. Blob search uses the :read_blob ability, but only ever on FoundBlob, which retains its project for now. That's for tackling separately in https://gitlab.com/gitlab-org/gitlab/-/issues/213818 .

Does this MR meet the acceptance criteria?

Conformity

Part of #201886 (closed)

Merge request reports

Loading