Commit 4e6ab24d authored by Patrick Bajao's avatar Patrick Bajao

Don't delete LfsObjectsProject when forking

When an existing project becomes a fork of another project, we
previously delete the LfsObjectsProject records of that fork.

Since we're now making each fork to have its own records, we
shouldn't delete records in that case anymore.
parent e73a8fed
......@@ -26,17 +26,7 @@ module Projects
build_fork_network_member(fork_to_project)
if link_fork_network(fork_to_project)
# A forked project stores its LFS objects in the `forked_from_project`.
# So the LFS objects become inaccessible, and therefore delete them from
# the database so they'll get cleaned up.
#
# TODO: refactor this to get the correct lfs objects when implementing
# https://gitlab.com/gitlab-org/gitlab-foss/issues/39769
fork_to_project.lfs_objects_projects.delete_all
fork_to_project
end
fork_to_project if link_fork_network(fork_to_project)
end
def fork_new_project
......
......@@ -2000,11 +2000,6 @@ Allows modification of the forked relationship between existing projects. Availa
### Create a forked from/to relation between existing projects
CAUTION: **Warning:**
This will destroy the LFS objects stored in the fork.
So to retain the LFS objects, make sure you've pulled them **before** creating the fork relation,
and push them again **after** creating the fork relation.
```
POST /projects/:id/fork/:forked_from_id
```
......
......@@ -375,14 +375,6 @@ describe Projects::ForkService do
expect(fork_from_project.forks_count).to eq(1)
end
it 'leaves no LFS objects dangling' do
create(:lfs_objects_project, project: fork_to_project)
expect { subject.execute(fork_to_project) }
.to change { fork_to_project.lfs_objects_projects.count }
.to(0)
end
context 'if the fork is not allowed' do
let(:fork_from_project) { create(:project, :private) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment