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:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-02-02 18:27:30 +0300
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-02-06 19:52:29 +0300
commit1e56b3f476f9779ec747534e94156a6b8076209c (patch)
treee9374a520232a2d96ef55bf3089dd5350db0a900 /app/controllers/projects
parent839829a7786dd163eccb470bf251211bfb90bd72 (diff)
Moves project creationg to git access check for git push
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/git_http_controller.rb19
1 files changed, 7 insertions, 12 deletions
diff --git a/app/controllers/projects/git_http_controller.rb b/app/controllers/projects/git_http_controller.rb
index 90a9079fab3..45910a9be44 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
@@ -36,10 +35,6 @@ class Projects::GitHttpController < Projects::GitHttpClientController
git_command == 'git-upload-pack'
end
- def receive_pack?
- git_command == 'git-receive-pack'
- end
-
def git_command
if action_name == 'info_refs'
params[:service]
@@ -48,10 +43,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 +61,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 +76,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