From f5551efdfd71c6aedb609093374a6c4dbed6a78b Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 27 Nov 2012 09:31:15 +0300 Subject: Rewrite and improve git backend logic. Fix project movind. Raise exception to prevent unexpected issues --- app/models/namespace.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/models/namespace.rb') diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 8eae36db8e2..4e6125e354a 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -35,6 +35,10 @@ class Namespace < ActiveRecord::Base where("name LIKE :query OR path LIKE :query", query: "%#{query}%") end + def self.global_id + 'GLN' + end + def to_param path end @@ -51,6 +55,9 @@ class Namespace < ActiveRecord::Base def move_dir old_path = File.join(Gitlab.config.git_base_path, path_was) new_path = File.join(Gitlab.config.git_base_path, path) + if File.exists?(new_path) + raise "Already exists" + end system("mv #{old_path} #{new_path}") end -- cgit v1.2.1