Commit 30912835e3a6824459e1cc64e3144fe90b9aa959

Authored by Dmitriy Zaporozhets
1 parent 182aa19e

Correctly remove and re-create satellites when project transfer

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing 1 changed file with 6 additions and 2 deletions   Show diff stats
app/services/project_transfer_service.rb
@@ -18,6 +18,10 @@ class ProjectTransferService @@ -18,6 +18,10 @@ class ProjectTransferService
18 raise TransferError.new("Project with same path in target namespace already exists") 18 raise TransferError.new("Project with same path in target namespace already exists")
19 end 19 end
20 20
  21 + # Remove old satellite
  22 + project.satellite.destroy
  23 +
  24 + # Apply new namespace id
21 project.namespace = new_namespace 25 project.namespace = new_namespace
22 project.save! 26 project.save!
23 27
@@ -29,8 +33,8 @@ class ProjectTransferService @@ -29,8 +33,8 @@ class ProjectTransferService
29 # Move wiki repo also if present 33 # Move wiki repo also if present
30 gitlab_shell.mv_repository("#{old_path}.wiki", "#{new_path}.wiki") 34 gitlab_shell.mv_repository("#{old_path}.wiki", "#{new_path}.wiki")
31 35
32 - # create satellite repo  
33 - project.ensure_satellite_exists 36 + # Create a new satellite (reload project from DB)
  37 + Project.find(project.id).ensure_satellite_exists
34 38
35 # clear project cached events 39 # clear project cached events
36 project.reset_events_cache 40 project.reset_events_cache