refactor project create service
This commit is contained in:
parent
80112ca4ec
commit
86257cf713
2 changed files with 3 additions and 3 deletions
|
@ -639,7 +639,7 @@ class Project < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def import?
|
def import?
|
||||||
external_import? || forked? || gitlab_project_import?
|
external_import? || forked? || gitlab_project_import? || bare_repository_import?
|
||||||
end
|
end
|
||||||
|
|
||||||
def no_import?
|
def no_import?
|
||||||
|
|
|
@ -120,7 +120,7 @@ module Projects
|
||||||
Project.transaction do
|
Project.transaction do
|
||||||
@project.create_or_update_import_data(data: import_data[:data], credentials: import_data[:credentials]) if import_data
|
@project.create_or_update_import_data(data: import_data[:data], credentials: import_data[:credentials]) if import_data
|
||||||
|
|
||||||
if @project.save && !@project.import? && !@project.bare_repository_import?
|
if @project.save && !@project.import?
|
||||||
raise 'Failed to create repository' unless @project.create_repository
|
raise 'Failed to create repository' unless @project.create_repository
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -165,7 +165,7 @@ module Projects
|
||||||
|
|
||||||
def import_schedule
|
def import_schedule
|
||||||
if @project.errors.empty?
|
if @project.errors.empty?
|
||||||
@project.import_schedule if @project.import?
|
@project.import_schedule if @project.import? && !@project.bare_repository_import?
|
||||||
else
|
else
|
||||||
fail(error: @project.errors.full_messages.join(', '))
|
fail(error: @project.errors.full_messages.join(', '))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue