diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/git_http_controller.rb | 15 | ||||
-rw-r--r-- | app/services/projects/create_from_push_service.rb | 5 |
2 files changed, 9 insertions, 11 deletions
diff --git a/app/controllers/projects/git_http_controller.rb b/app/controllers/projects/git_http_controller.rb index 90a9079fab3..3d3a444b718 100644 --- a/app/controllers/projects/git_http_controller.rb +++ b/app/controllers/projects/git_http_controller.rb @@ -11,7 +11,6 @@ class Projects::GitHttpController < Projects::GitHttpClientController # GET /foo/bar.git/info/refs?service=git-receive-pack (git push) def info_refs log_user_activity if upload_pack? - create_new_project if receive_pack? && project.blank? render_ok end @@ -48,10 +47,6 @@ class Projects::GitHttpController < Projects::GitHttpClientController end end - def create_new_project - @project = ::Projects::CreateFromPushService.new(user, params[:project_id], namespace, 'http').execute - end - def render_ok set_workhorse_internal_api_content_type render json: Gitlab::Workhorse.git_http_ok(repository, wiki?, user, action_name) @@ -70,7 +65,10 @@ class Projects::GitHttpController < Projects::GitHttpClientController end def access - @access ||= access_klass.new(access_actor, project, 'http', authentication_abilities: authentication_abilities, redirected_path: redirected_path, target_namespace: namespace) + @access ||= access_klass.new(access_actor, project, + 'http', authentication_abilities: authentication_abilities, + namespace_path: params[:namespace_id], project_path: project_path, + redirected_path: redirected_path) end def access_actor @@ -82,14 +80,15 @@ class Projects::GitHttpController < Projects::GitHttpClientController # Use the magic string '_any' to indicate we do not know what the # changes are. This is also what gitlab-shell does. access.check(git_command, '_any') + @project ||= access.project end def access_klass @access_klass ||= wiki? ? Gitlab::GitAccessWiki : Gitlab::GitAccess end - def namespace - @namespace ||= Namespace.find_by_full_path(params[:namespace_id]) + def project_path + @project_path ||= params[:project_id].sub(/\.git$/, '') end def log_user_activity diff --git a/app/services/projects/create_from_push_service.rb b/app/services/projects/create_from_push_service.rb index 949a0bfdc09..c38fdf04cc5 100644 --- a/app/services/projects/create_from_push_service.rb +++ b/app/services/projects/create_from_push_service.rb @@ -27,10 +27,9 @@ module Projects def project_params { - description: "", - path: project_path.gsub(/\.git$/, ''), + path: project_path, namespace_id: namespace&.id, - visibility_level: Gitlab::VisibilityLevel::PRIVATE.to_s + visibility_level: Gitlab::VisibilityLevel::PRIVATE } end end |