Write project full path to .git/config when creating projects
We'd need to keep track of project full path otherwise directory tree created with hashed storage enabled cannot be usefully imported using the import rake task.
This commit is contained in:
parent
946a3634bc
commit
9504a529b7
|
@ -1432,6 +1432,11 @@ class Project < ActiveRecord::Base
|
||||||
Gitlab::PagesTransfer.new.rename_project(path_before_change, self.path, namespace.full_path)
|
Gitlab::PagesTransfer.new.rename_project(path_before_change, self.path, namespace.full_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def write_repository_config(key, value, prefix: :gitlab)
|
||||||
|
key = [prefix, key].compact.join('.')
|
||||||
|
repo.config[key] = value
|
||||||
|
end
|
||||||
|
|
||||||
def rename_repo_notify!
|
def rename_repo_notify!
|
||||||
send_move_instructions(full_path_was)
|
send_move_instructions(full_path_was)
|
||||||
expires_full_path_cache
|
expires_full_path_cache
|
||||||
|
|
|
@ -87,6 +87,11 @@ module Projects
|
||||||
def after_create_actions
|
def after_create_actions
|
||||||
log_info("#{@project.owner.name} created a new project \"#{@project.name_with_namespace}\"")
|
log_info("#{@project.owner.name} created a new project \"#{@project.name_with_namespace}\"")
|
||||||
|
|
||||||
|
# We'd need to keep track of project full path otherwise directory tree
|
||||||
|
# created with hashed storage enabled cannot be usefully imported using
|
||||||
|
# the import rake task.
|
||||||
|
@project.write_repository_config(:fullpath, @project.full_path)
|
||||||
|
|
||||||
unless @project.gitlab_project_import?
|
unless @project.gitlab_project_import?
|
||||||
@project.create_wiki unless skip_wiki?
|
@project.create_wiki unless skip_wiki?
|
||||||
create_services_from_active_templates(@project)
|
create_services_from_active_templates(@project)
|
||||||
|
|
|
@ -252,6 +252,12 @@ describe Projects::CreateService, '#execute' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'writes project full path to .git/config' do
|
||||||
|
project = create_project(user, opts)
|
||||||
|
|
||||||
|
expect(project.repo.config['gitlab.fullpath']).to eq project.full_path
|
||||||
|
end
|
||||||
|
|
||||||
def create_project(user, opts)
|
def create_project(user, opts)
|
||||||
Projects::CreateService.new(user, opts).execute
|
Projects::CreateService.new(user, opts).execute
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue