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 18 raise TransferError.new("Project with same path in target namespace already exists")
19 19 end
20 20  
  21 + # Remove old satellite
  22 + project.satellite.destroy
  23 +
  24 + # Apply new namespace id
21 25 project.namespace = new_namespace
22 26 project.save!
23 27  
... ... @@ -29,8 +33,8 @@ class ProjectTransferService
29 33 # Move wiki repo also if present
30 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 39 # clear project cached events
36 40 project.reset_events_cache
... ...