Project -> update repo only on create and destroy. Fixtures Updated with namespaces. Fixed moving repo
This commit is contained in:
parent
cc52eed981
commit
70bf7f6e19
11 changed files with 45 additions and 31 deletions
|
@ -27,6 +27,7 @@ class Namespace < ActiveRecord::Base
|
|||
|
||||
after_create :ensure_dir_exist
|
||||
after_update :move_dir
|
||||
after_destroy :rm_dir
|
||||
|
||||
scope :root, where('type IS NULL')
|
||||
|
||||
|
@ -52,4 +53,9 @@ class Namespace < ActiveRecord::Base
|
|||
new_path = File.join(Gitlab.config.git_base_path, path)
|
||||
system("mv #{old_path} #{new_path}")
|
||||
end
|
||||
|
||||
def rm_dir
|
||||
dir_path = File.join(Gitlab.config.git_base_path, path)
|
||||
system("rm -rf #{dir_path}")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -254,6 +254,10 @@ class Project < ActiveRecord::Base
|
|||
old_dir = old_namespace.try(:path) || ''
|
||||
new_dir = new_namespace.try(:path) || ''
|
||||
|
||||
old_repo = File.join(old_dir, self.path)
|
||||
|
||||
git_host.move_repository(old_repo, self.path_with_namespace, self)
|
||||
|
||||
Gitlab::ProjectMover.new(self, old_dir, new_dir).execute
|
||||
|
||||
save!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue