diff options
author | Nick Thomas <nick@gitlab.com> | 2017-11-17 14:23:47 +0000 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2017-11-17 14:27:34 +0000 |
commit | 1fe4240ca51b064868b2388f5ee0afec4ec7e08a (patch) | |
tree | 968180964c1be889ebf298946a827a04335d4863 /app/services/projects/transfer_service.rb | |
parent | 40413868083a88f9b5386165184be6758e20bc33 (diff) | |
download | gitlab-ce-1fe4240ca51b064868b2388f5ee0afec4ec7e08a.tar.gz |
Merge branch 'sh-port-hashed-storage-transfer-fix' into 'master'10-2-stable-prepare-rc3
Fix hashed storage with project transfers to another namespace
Closes gitlab-ee#4056
See merge request gitlab-org/gitlab-ce!15444
(cherry picked from commit 76b2a7caa5219662a29f0eb16f0507aac1976f33)
0c085aaf Fix hashed storage with project transfers to another namespace
Diffstat (limited to 'app/services/projects/transfer_service.rb')
-rw-r--r-- | app/services/projects/transfer_service.rb | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index 5957f612e84..d3a8ae8d7c6 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -60,15 +60,8 @@ module Projects # Notifications project.send_move_instructions(@old_path) - # Move main repository - # TODO: check storage type and NOOP when not using Legacy - unless move_repo_folder(@old_path, @new_path) - raise TransferError.new('Cannot move project') - end - - # Move wiki repo also if present - # TODO: check storage type and NOOP when not using Legacy - move_repo_folder("#{@old_path}.wiki", "#{@new_path}.wiki") + # Directories on disk + move_project_folders(project) # Move missing group labels to project Labels::TransferService.new(current_user, @old_group, project).execute @@ -131,5 +124,20 @@ module Projects def execute_system_hooks SystemHooksService.new.execute_hooks_for(project, :transfer) end + + def move_project_folders(project) + return if project.hashed_storage?(:repository) + + # Move main repository + unless move_repo_folder(@old_path, @new_path) + raise TransferError.new("Cannot move project") + end + + # Disk path is changed; we need to ensure we reload it + project.reload_repository! + + # Move wiki repo also if present + move_repo_folder("#{@old_path}.wiki", "#{@new_path}.wiki") + end end end |