Commit bc35e375 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'sh-disable-gitconfig-write-on-imports-and-forks' into 'master'

Defer updating .git/config for imported projects

See merge request gitlab-org/gitlab!35308
parents 982ed637 02e4d7fe
......@@ -84,8 +84,12 @@ module Projects
def after_create_actions
log_info("#{@project.owner.name} created a new project \"#{@project.full_name}\"")
# Skip writing the config for project imports/forks because it
# will always fail since the Git directory doesn't exist until
# a background job creates it (see Project#add_import_job).
@project.write_repository_config unless @project.import?
unless @project.gitlab_project_import?
@project.write_repository_config
@project.create_wiki unless skip_wiki?
end
......
---
title: Defer updating .git/config for imported projects
merge_request: 35308
author:
type: fixed
......@@ -240,13 +240,21 @@ RSpec.describe Projects::CreateService, '#execute' do
end
context 'import data' do
it 'stores import data and URL' do
import_data = { data: { 'test' => 'some data' } }
project = create_project(user, { name: 'test', import_url: 'http://import-url', import_data: import_data })
let(:import_data) { { data: { 'test' => 'some data' } } }
let(:imported_project) { create_project(user, { name: 'test', import_url: 'http://import-url', import_data: import_data }) }
it 'does not write repository config' do
expect_next_instance_of(Project) do |project|
expect(project).not_to receive(:write_repository_config)
end
expect(project.import_data).to be_persisted
expect(project.import_data.data).to eq(import_data[:data])
expect(project.import_url).to eq('http://import-url')
imported_project
end
it 'stores import data and URL' do
expect(imported_project.import_data).to be_persisted
expect(imported_project.import_data.data).to eq(import_data[:data])
expect(imported_project.import_url).to eq('http://import-url')
end
end
......
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