diff options
author | Rémy Coutable <remy@gitlab.com> | 2017-03-28 17:27:44 +0000 |
---|---|---|
committer | DJ Mountney <david@twkie.net> | 2017-03-29 19:16:50 -0700 |
commit | 60c0c0f3d08aa2c2a5be68aa784a86304fdb9c99 (patch) | |
tree | 36fc5767de0d2d9bdd7a996677d3130a43f7ea95 /app/models/namespace.rb | |
parent | 97a5e91bbe9449a448fae5373cbf91087578cbc6 (diff) | |
download | gitlab-ce-60c0c0f3d08aa2c2a5be68aa784a86304fdb9c99.tar.gz |
Merge branch '29843-project-subgroup-transfer' into 'security'
Use full path for moving directories when changing namespace path
See merge request !2078
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r-- | app/models/namespace.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 826ded22ae5..1d4b1f7d590 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -120,10 +120,10 @@ class Namespace < ActiveRecord::Base # Move the namespace directory in all storages paths used by member projects repository_storage_paths.each do |repository_storage_path| # Ensure old directory exists before moving it - gitlab_shell.add_namespace(repository_storage_path, path_was) + gitlab_shell.add_namespace(repository_storage_path, full_path_was) - unless gitlab_shell.mv_namespace(repository_storage_path, path_was, path) - Rails.logger.error "Exception moving path #{repository_storage_path} from #{path_was} to #{path}" + unless gitlab_shell.mv_namespace(repository_storage_path, full_path_was, full_path) + Rails.logger.error "Exception moving path #{repository_storage_path} from #{full_path_was} to #{full_path}" # if we cannot move namespace directory we should rollback # db changes in order to prevent out of sync between db and fs @@ -131,8 +131,8 @@ class Namespace < ActiveRecord::Base end end - Gitlab::UploadsTransfer.new.rename_namespace(path_was, path) - Gitlab::PagesTransfer.new.rename_namespace(path_was, path) + Gitlab::UploadsTransfer.new.rename_namespace(full_path_was, full_path) + Gitlab::PagesTransfer.new.rename_namespace(full_path_was, full_path) remove_exports! @@ -155,7 +155,7 @@ class Namespace < ActiveRecord::Base def send_update_instructions projects.each do |project| - project.send_move_instructions("#{path_was}/#{project.path}") + project.send_move_instructions("#{full_path_was}/#{project.path}") end end @@ -230,10 +230,10 @@ class Namespace < ActiveRecord::Base old_repository_storage_paths.each do |repository_storage_path| # Move namespace directory into trash. # We will remove it later async - new_path = "#{path}+#{id}+deleted" + new_path = "#{full_path}+#{id}+deleted" - if gitlab_shell.mv_namespace(repository_storage_path, path, new_path) - message = "Namespace directory \"#{path}\" moved to \"#{new_path}\"" + if gitlab_shell.mv_namespace(repository_storage_path, full_path, new_path) + message = "Namespace directory \"#{full_path}\" moved to \"#{new_path}\"" Gitlab::AppLogger.info message # Remove namespace directroy async with delay so |