Commit e9394c48ca7aacd9d151519c1da51d18a21b351b

Authored by Dmitriy Zaporozhets
1 parent d03964d6

Fix dir_exists?

Showing 1 changed file with 8 additions and 3 deletions   Show diff stats
app/models/namespace.rb
@@ -51,12 +51,17 @@ class Namespace < ActiveRecord::Base @@ -51,12 +51,17 @@ class Namespace < ActiveRecord::Base
51 end 51 end
52 52
53 def ensure_dir_exist 53 def ensure_dir_exist
54 - dir_exists? || system("mkdir -m 770 #{namespace_dir_path}") 54 + unless dir_exists?
  55 + system("mkdir -m 770 #{namespace_full_path}")
  56 + end
55 end 57 end
56 58
57 def dir_exists? 59 def dir_exists?
58 - namespace_dir_path = File.join(Gitlab.config.gitolite.repos_path, path)  
59 - File.exists?(namespace_dir_path) 60 + File.exists?(namespace_full_path)
  61 + end
  62 +
  63 + def namespace_full_path
  64 + @namespace_full_path ||= File.join(Gitlab.config.gitolite.repos_path, path)
60 end 65 end
61 66
62 def move_dir 67 def move_dir