Merge branch 'bvl-fork-network-memberships-for-deleted-source' into 'master'
Don't try to create fork network memberships for forks of forks Closes #40072 See merge request gitlab-org/gitlab-ce!15366
This commit is contained in:
commit
3730d89fe8
3 changed files with 24 additions and 2 deletions
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Don't try to create fork network memberships for forks with a missing source
|
||||
merge_request: 15366
|
||||
author:
|
||||
type: fixed
|
|
@ -51,10 +51,20 @@ module Gitlab
|
|||
FROM projects
|
||||
WHERE forked_project_links.forked_from_project_id = projects.id
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT true
|
||||
FROM forked_project_links AS parent_links
|
||||
WHERE parent_links.forked_to_project_id = forked_project_links.forked_from_project_id
|
||||
AND NOT EXISTS (
|
||||
SELECT true
|
||||
FROM projects
|
||||
WHERE parent_links.forked_from_project_id = projects.id
|
||||
)
|
||||
)
|
||||
AND forked_project_links.id BETWEEN #{start_id} AND #{end_id}
|
||||
MISSING_MEMBERS
|
||||
|
||||
ForkNetworkMember.count_by_sql(count_sql) > 0
|
||||
ForkedProjectLink.count_by_sql(count_sql) > 0
|
||||
end
|
||||
|
||||
def log(message)
|
||||
|
|
|
@ -93,7 +93,14 @@ describe Gitlab::BackgroundMigration::CreateForkNetworkMembershipsRange, :migrat
|
|||
end
|
||||
|
||||
it 'knows it is finished for this range' do
|
||||
expect(migration.missing_members?(1, 7)).to be_falsy
|
||||
expect(migration.missing_members?(1, 8)).to be_falsy
|
||||
end
|
||||
|
||||
it 'does not miss members for forks of forks for which the root was deleted' do
|
||||
forked_project_links.create(id: 9, forked_from_project_id: base1_fork1.id, forked_to_project_id: create(:project).id)
|
||||
base1.destroy
|
||||
|
||||
expect(migration.missing_members?(7, 10)).to be_falsy
|
||||
end
|
||||
|
||||
context 'with more forks' do
|
||||
|
|
Loading…
Reference in a new issue