Skip to content
Snippets Groups Projects

4 0 stable

Closed gitlab-qa-bot requested to merge 4-0-stable into master
3 files
+ 45
1
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 11
0
@@ -27,10 +27,13 @@ class Namespace < ActiveRecord::Base
@@ -27,10 +27,13 @@ class Namespace < ActiveRecord::Base
after_create :ensure_dir_exist
after_create :ensure_dir_exist
after_update :move_dir
after_update :move_dir
 
after_commit :update_gitolite, on: :update, if: :require_update_gitolite
after_destroy :rm_dir
after_destroy :rm_dir
scope :root, where('type IS NULL')
scope :root, where('type IS NULL')
 
attr_accessor :require_update_gitolite
 
def self.search query
def self.search query
where("name LIKE :query OR path LIKE :query", query: "%#{query}%")
where("name LIKE :query OR path LIKE :query", query: "%#{query}%")
end
end
@@ -62,10 +65,18 @@ class Namespace < ActiveRecord::Base
@@ -62,10 +65,18 @@ class Namespace < ActiveRecord::Base
if system("mv #{old_path} #{new_path}")
if system("mv #{old_path} #{new_path}")
send_update_instructions
send_update_instructions
 
@require_update_gitolite = true
 
else
 
raise "Namespace move error #{old_path} #{new_path}"
end
end
end
end
end
end
 
def update_gitolite
 
@require_update_gitolite = false
 
projects.each(&:update_repository)
 
end
 
def rm_dir
def rm_dir
dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
system("rm -rf #{dir_path}")
system("rm -rf #{dir_path}")
Loading