Allow internal projects to create or join an object pool
Problem to solve
GitLab support Git object deduplication for repositories and their forks. A current limitation; it's only supported for public projects. This does not allow the deduplication of internal or private project. For this iteration the intention is to allow only
internal projects. The ACLs are the same for internal as for public, if a user is signed in which makes it a relatively small change.
Though the feature works out of the box, without Sidney having to lift a finger.
Allow git objects to be pooled for all projects, except when private:
diff --git a/app/models/project.rb b/app/models/project.rb index 512734e9b3f..2241f319276 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -2218,12 +2218,12 @@ class Project < ApplicationRecord # Git objects are only poolable when the project is or has: # - Hashed storage -> The object pool will have a remote to its members, using relative paths. # If the repository path changes we would have to update the remote. - # - Public -> User will be able to fetch Git objects that might not exist + # - Not private -> User will be able to fetch Git objects that might not exist # in their own repository. # - Repository -> Else the disk path will be empty, and there's nothing to pool def git_objects_poolable? hashed_storage?(:repository) && - public? && + !private? && repository_exists? && Gitlab::CurrentSettings.hashed_storage_enabled end
Permissions and Security
The same ACLs apply as for the public deduplicated repositories. Any data pushed to the source project of an object pool should be considered public to everyone with access.
Remove the caveat that internal project are excluded, and it should be good enough already.