Handle LFS objects for fork networks
Currently when the source of a fork(-network) is deleted, the forked project loses track of its LFS-objects.
We should figure out a way to handle this.
Possible solutions:
- Add the LFS objects to the forked project immeadiatly after the fork. The objects will then be handled independently of the fork network and count towards the quota of the namespace the fork resides in.
- Add the LFS objects to all the forked projects when the root project is deleted. This could be a lot of forks, but it's handled in the background.
- Keep track of the LFS-objects on a fork network. But to which quota do they count?
Later created fork relations
Another issue was brought up in gitlab-org/gitlab-ce!18104:
When a fork relation is created later on, the LFS objects of the fork might be somewhere else than the LFS objects of the parent. So at that point the objects of the fork become inaccessible, and the user should push the LFS objects again after creating the fork relation.
The deletion now happens in the Projects::ForkService#link_existing_project
, that might have to be reconsidered when implementing this: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22226#note_108780553
Newly uploaded LFS objects
Right now, we're doing 2 different things:
- When a user pushes LFS objects through their git-lfs client, the uploads go through workhorse and in
Projects::LfsStorageController#upload_finalize!
and#link_project!
which uses theLfsRequest#storage_project
. - When a user uploads through the web UI, this would be dealt with in this transformer, the LFS object would be linked to the current project and would become inaccessible.
This is being changed in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31224 to all upload to the root of the fork network, but make LFS objects linked to the project itself accessible as well.
We should decide on the right project to link to LFS objects uploaded for a fork.
Related issues
This relates to https://gitlab.com/gitlab-org/gitlab-ce/issues/38883, and was brought up in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15150#note_45541479