diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-02-24 15:39:12 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-02-24 15:39:12 +0000 |
commit | faaca5e191f9fe3894ad7587b42495fcbcab9328 (patch) | |
tree | dff5dce220d1de3e17e9f39d58bb658719ece282 /app/models | |
parent | 3589cc064c3ba0b5a6b062c317368dfe9183d1ba (diff) | |
parent | dfbccdfc1b119ff801f810607b724e4572e37bb1 (diff) | |
download | gitlab-ce-faaca5e191f9fe3894ad7587b42495fcbcab9328.tar.gz |
Merge branch 'dm-more-namespace-full-path' into 'master'
Use Namespace#full_path instead of #path where appropriate
See merge request !9495
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/project.rb | 10 | ||||
-rw-r--r-- | app/models/user.rb | 2 |
2 files changed, 4 insertions, 8 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 814fd0c0f4f..aedd5bedcb9 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -359,7 +359,7 @@ class Project < ActiveRecord::Base end def reference_pattern - name_pattern = Gitlab::Regex::NAMESPACE_REGEX_STR + name_pattern = Gitlab::Regex::FULL_NAMESPACE_REGEX_STR %r{ ((?<namespace>#{name_pattern})\/)? @@ -847,10 +847,6 @@ class Project < ActiveRecord::Base gitlab_shell.url_to_repo(path_with_namespace) end - def namespace_dir - namespace.try(:path) || '' - end - def repo_exists? @repo_exists ||= repository.exists? rescue @@ -899,8 +895,8 @@ class Project < ActiveRecord::Base def rename_repo path_was = previous_changes['path'].first - old_path_with_namespace = File.join(namespace_dir, path_was) - new_path_with_namespace = File.join(namespace_dir, path) + old_path_with_namespace = File.join(namespace.full_path, path_was) + new_path_with_namespace = File.join(namespace.full_path, path) Rails.logger.error "Attempting to rename #{old_path_with_namespace} -> #{new_path_with_namespace}" diff --git a/app/models/user.rb b/app/models/user.rb index fada0e567f0..f0905cc305b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -334,7 +334,7 @@ class User < ActiveRecord::Base def reference_pattern %r{ #{Regexp.escape(reference_prefix)} - (?<user>#{Gitlab::Regex::NAMESPACE_REF_REGEX_STR}) + (?<user>#{Gitlab::Regex::FULL_NAMESPACE_REGEX_STR}) }x end end |