Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-01 15:09:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-01 15:09:17 +0300
commit7b2635a55d4e87431bae752bd44c6fd2d2657b03 (patch)
tree88182aabb51a167e10f6c3a6d404b2247613047f /lib/gitlab/git_access_project.rb
parenta7704bf16a51a8c993215a69db17232e3f246b8e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/git_access_project.rb')
-rw-r--r--lib/gitlab/git_access_project.rb16
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
}