diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /lib/gitlab/git_access_project.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'lib/gitlab/git_access_project.rb')
-rw-r--r-- | lib/gitlab/git_access_project.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/gitlab/git_access_project.rb b/lib/gitlab/git_access_project.rb index cdefcc84f7d..7e9bab4a8e6 100644 --- a/lib/gitlab/git_access_project.rb +++ b/lib/gitlab/git_access_project.rb @@ -35,7 +35,19 @@ module Gitlab end def namespace - @namespace ||= Namespace.find_by_full_path(namespace_path) + strong_memoize(:namespace) { Namespace.find_by_full_path(namespace_path) } + end + + def namespace_path + strong_memoize(:namespace_path) { repository_path_match[:namespace_path] } + end + + def project_path + strong_memoize(:project_path) { repository_path_match[:project_path] } + end + + def repository_path_match + strong_memoize(:repository_path_match) { repository_path.match(Gitlab::PathRegex.full_project_git_path_regex) || {} } end def ensure_project_on_push! @@ -44,7 +56,7 @@ module Gitlab return unless user&.can?(:create_projects, namespace) project_params = { - path: repository_path, + path: project_path, namespace_id: namespace.id, visibility_level: Gitlab::VisibilityLevel::PRIVATE } |