Commit 02276f7a authored by James Lopez's avatar James Lopez

Fix import scheduled on bare repo import

parent ac35636f
......@@ -12,6 +12,7 @@ module Projects
forked_from_project_id = params.delete(:forked_from_project_id)
import_data = params.delete(:import_data)
@skip_wiki = params.delete(:skip_wiki)
@skip_import = params.delete(:skip_import)
@project = Project.new(params)
......@@ -57,7 +58,7 @@ module Projects
after_create_actions if @project.persisted?
if @project.errors.empty?
@project.import_schedule if @project.import?
@project.import_schedule if @project.import? && !@skip_import
else
fail(error: @project.errors.full_messages.join(', '))
end
......
......@@ -55,6 +55,8 @@ module Gitlab
name: project_name,
path: project_name,
skip_disk_validation: true,
skip_wiki: bare_repo.wiki_exists?,
skip_import: true,
import_type: 'gitlab_project',
namespace_id: group&.id).execute
......
......@@ -68,6 +68,12 @@ describe Gitlab::BareRepositoryImport::Importer, repository: true do
expect(Project.find_by_full_path(project_path)).not_to be_nil
end
it 'does not schedule an import' do
expect_any_instance_of(Project).not_to receive(:import_schedule)
importer.create_project_if_needed
end
it 'creates the Git repo in disk' do
FileUtils.mkdir_p(File.join(base_dir, "#{project_path}.git"))
......@@ -161,6 +167,8 @@ describe Gitlab::BareRepositoryImport::Importer, repository: true do
FileUtils.mkdir_p(File.join(base_dir, "#{project_path}.git"))
FileUtils.mkdir_p(File.join(base_dir, "#{project_path}.wiki.git"))
expect(Projects::CreateService).to receive(:new).with(admin, hash_including(skip_import: true)).and_call_original
importer.create_project_if_needed
project = Project.find_by_full_path(project_path)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment