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.
parent 946a3634
......@@ -1432,6 +1432,11 @@ class Project < ActiveRecord::Base
Gitlab::PagesTransfer.new.rename_project(path_before_change, self.path, namespace.full_path)
end
def write_repository_config(key, value, prefix: :gitlab)
key = [prefix, key].compact.join('.')
repo.config[key] = value
end
def rename_repo_notify!
send_move_instructions(full_path_was)
expires_full_path_cache
......
......@@ -87,6 +87,11 @@ module Projects
def after_create_actions
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?
@project.create_wiki unless skip_wiki?
create_services_from_active_templates(@project)
......
......@@ -252,6 +252,12 @@ describe Projects::CreateService, '#execute' do
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)
Projects::CreateService.new(user, opts).execute
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