Skip to content

The API isn't using the appropriate services for managing forks

In the API it is possible to mark an existing project as a fork of another project, however, this endpoint does not use a service to do so, it just creates the ForkedProjectLink which means the new ForkNetwork and ForkNetworkMember aren't created:

https://gitlab.com/gitlab-org/gitlab-ce/blob/c594659fea15c6dd17b9ea4c6b88c5a418f10ab9/lib/api/projects.rb#L363

Further, when unlinking a fork, the API does not use the Projects::UnlinkForkService

https://gitlab.com/gitlab-org/gitlab-ce/blob/c594659fea15c6dd17b9ea4c6b88c5a418f10ab9/lib/api/projects.rb#L382

This means that some ForkedNetworkMember models might be left when unlinking a fork using the API.

/cc @DouweM @fjsanpedro