Commit 3f1d6d6a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

move namespace dir after path changed

parent f37fa968
...@@ -12,7 +12,8 @@ class Namespace < ActiveRecord::Base ...@@ -12,7 +12,8 @@ class Namespace < ActiveRecord::Base
delegate :name, to: :owner, allow_nil: true, prefix: true delegate :name, to: :owner, allow_nil: true, prefix: true
after_save :ensure_dir_exist after_create :ensure_dir_exist
after_update :move_dir
scope :root, where('type IS NULL') scope :root, where('type IS NULL')
...@@ -32,4 +33,10 @@ class Namespace < ActiveRecord::Base ...@@ -32,4 +33,10 @@ class Namespace < ActiveRecord::Base
namespace_dir_path = File.join(Gitlab.config.git_base_path, path) namespace_dir_path = File.join(Gitlab.config.git_base_path, path)
Dir.mkdir(namespace_dir_path) unless File.exists?(namespace_dir_path) Dir.mkdir(namespace_dir_path) unless File.exists?(namespace_dir_path)
end end
def move_dir
old_path = File.join(Gitlab.config.git_base_path, path_was)
new_path = File.join(Gitlab.config.git_base_path, path)
system("mv #{old_path} #{new_path}")
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment