diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/namespace.rb | 6 | ||||
| -rw-r--r-- | app/observers/user_observer.rb | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 96f8f291451..d9c45cb13e2 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -51,8 +51,12 @@ class Namespace < ActiveRecord::Base end def ensure_dir_exist + dir_exists? || system("mkdir -m 770 #{namespace_dir_path}") + end + + def dir_exists? namespace_dir_path = File.join(Gitlab.config.gitolite.repos_path, path) - system("mkdir -m 770 #{namespace_dir_path}") unless File.exists?(namespace_dir_path) + File.exists?(namespace_dir_path) end def move_dir diff --git a/app/observers/user_observer.rb b/app/observers/user_observer.rb index 09b3c1d622f..73a1d00ca3b 100644 --- a/app/observers/user_observer.rb +++ b/app/observers/user_observer.rb @@ -14,7 +14,7 @@ class UserObserver < ActiveRecord::Observer if user.namespace user.namespace.update_attributes(path: user.username) else - user.create_namespace!(path: user.username, name: user.name) + user.create_namespace!(path: user.username, name: user.username) end end end |
