summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-01-18 09:31:00 +0000
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-02-06 13:35:35 +0000
commit921d2afc6989dfa8220032984f657210c07e8792 (patch)
tree21467fea1fa8b83766ad91e843ba0d95dfb3e051 /app/controllers
parentb9d547b12c3731160c456f3f20366e600ab99484 (diff)
downloadgitlab-ce-921d2afc6989dfa8220032984f657210c07e8792.tar.gz
Adds option to push over HTTP to create a new project
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/git_http_controller.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/app/controllers/projects/git_http_controller.rb b/app/controllers/projects/git_http_controller.rb
index 71ae60cb8cd..45a1a5cf0de 100644
--- a/app/controllers/projects/git_http_controller.rb
+++ b/app/controllers/projects/git_http_controller.rb
@@ -11,6 +11,12 @@ class Projects::GitHttpController < Projects::GitHttpClientController
def info_refs
log_user_activity if upload_pack?
+ if project.blank? && params[:service] == 'git-receive-pack'
+ @project = ::Projects::CreateService.new(access_actor, project_params).execute
+
+ return render_ok if @project.saved?
+ end
+
render_ok
end
@@ -26,6 +32,15 @@ class Projects::GitHttpController < Projects::GitHttpClientController
private
+ def project_params
+ {
+ description: "",
+ path: params[:project_id].gsub("\.git", ''),
+ namespace_id: namespace.id.to_s,
+ visibility_level: Gitlab::VisibilityLevel::PRIVATE.to_s
+ }
+ end
+
def download_request?
upload_pack?
end
@@ -56,7 +71,11 @@ class Projects::GitHttpController < Projects::GitHttpClientController
end
def access
- @access ||= access_klass.new(access_actor, project, 'http', authentication_abilities: authentication_abilities, redirected_path: redirected_path)
+ @access ||= access_klass.new(access_actor, project, 'http', authentication_abilities: authentication_abilities, redirected_path: redirected_path, target_namespace: namespace)
+ end
+
+ def namespace
+ @namespace = Namespace.find_by_path_or_name(params[:namespace_id])
end
def access_actor