Skip to content
Snippets Groups Projects
Commit 9504a529 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

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
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment