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
path: root/lib/api
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-01-18 19:07:07 +0300
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-02-06 16:35:35 +0300
commit35882e681b681f68a818bda9a8d2624edfecc219 (patch)
tree0688bc4a1f770c1be480c412b4553522aefe9878 /lib/api
parent921d2afc6989dfa8220032984f657210c07e8792 (diff)
Adds option to push over SSH to create a new project
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/internal.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 063f0d6599c..a83f714a1f3 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -43,7 +43,7 @@ module API
access_checker_klass = wiki? ? Gitlab::GitAccessWiki : Gitlab::GitAccess
access_checker = access_checker_klass
- .new(actor, project, protocol, authentication_abilities: ssh_authentication_abilities, redirected_path: redirected_path)
+ .new(actor, project, protocol, authentication_abilities: ssh_authentication_abilities, redirected_path: redirected_path, target_namespace: user.namespace)
begin
access_checker.check(params[:action], params[:changes])
@@ -51,6 +51,19 @@ module API
return { status: false, message: e.message }
end
+ if project.blank? && params[:action] == 'git-receive-pack'
+ project_params = {
+ description: "",
+ path: params[:project].split('/').last.gsub("\.git", ''),
+ namespace_id: user.namespace.id.to_s,
+ visibility_level: Gitlab::VisibilityLevel::PRIVATE.to_s
+ }
+
+ @project = ::Projects::CreateService.new(user, project_params).execute
+
+ return { status: false, message: "Could not create project" } unless @project.saved?
+ end
+
log_user_activity(actor)
{