Commit 3f1d6d6ab3a7e1b2bbbae7dcd17edc884f9fbf07
1 parent
f37fa968
Exists in
master
and in
4 other branches
move namespace dir after path changed
Showing
1 changed file
with
8 additions
and
1 deletions
Show diff stats
app/models/namespace.rb
... | ... | @@ -12,7 +12,8 @@ class Namespace < ActiveRecord::Base |
12 | 12 | |
13 | 13 | delegate :name, to: :owner, allow_nil: true, prefix: true |
14 | 14 | |
15 | - after_save :ensure_dir_exist | |
15 | + after_create :ensure_dir_exist | |
16 | + after_update :move_dir | |
16 | 17 | |
17 | 18 | scope :root, where('type IS NULL') |
18 | 19 | |
... | ... | @@ -32,4 +33,10 @@ class Namespace < ActiveRecord::Base |
32 | 33 | namespace_dir_path = File.join(Gitlab.config.git_base_path, path) |
33 | 34 | Dir.mkdir(namespace_dir_path) unless File.exists?(namespace_dir_path) |
34 | 35 | end |
36 | + | |
37 | + def move_dir | |
38 | + old_path = File.join(Gitlab.config.git_base_path, path_was) | |
39 | + new_path = File.join(Gitlab.config.git_base_path, path) | |
40 | + system("mv #{old_path} #{new_path}") | |
41 | + end | |
35 | 42 | end | ... | ... |