diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-10 00:08:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-10 00:08:21 +0300 |
commit | 64786982930713d095ccd3aebd812182a1879fed (patch) | |
tree | 542e79df02f79049d8a63b31388c7d1e3e3b9166 /lib/gitlab/git_access.rb | |
parent | 3d0474695407d24d49bb94f29a182739ee35e1f8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/git_access.rb')
-rw-r--r-- | lib/gitlab/git_access.rb | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index 6702c053fc7..37e3da984d6 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -8,7 +8,6 @@ module Gitlab ForbiddenError = Class.new(StandardError) NotFoundError = Class.new(StandardError) - ProjectCreationError = Class.new(StandardError) TimeoutError = Class.new(StandardError) ProjectMovedError = Class.new(NotFoundError) @@ -75,7 +74,7 @@ module Gitlab check_db_accessibility!(cmd) check_namespace! - check_project!(changes, cmd) + check_project!(cmd) check_repository_existence! case cmd @@ -112,8 +111,7 @@ module Gitlab private - def check_project!(changes, cmd) - ensure_project_on_push!(cmd, changes) + def check_project!(_cmd) check_project_accessibility! add_project_moved_message! end @@ -230,32 +228,6 @@ module Gitlab end end - def ensure_project_on_push!(cmd, changes) - return if project || deploy_key? - return unless receive_pack?(cmd) && changes == ANY && authentication_abilities.include?(:push_code) - - namespace = Namespace.find_by_full_path(namespace_path) - - return unless user&.can?(:create_projects, namespace) - - project_params = { - path: repository_path, - namespace_id: namespace.id, - visibility_level: Gitlab::VisibilityLevel::PRIVATE - } - - project = Projects::CreateService.new(user, project_params).execute - - unless project.saved? - raise ProjectCreationError, "Could not create project: #{project.errors.full_messages.join(', ')}" - end - - @project = project - user_access.project = @project - - Checks::ProjectCreated.new(repository, user, protocol).add_message - end - def check_repository_existence! unless repository.exists? raise NotFoundError, ERROR_MESSAGES[:no_repo] |