Read about our upcoming Code of Conduct on this issue

Commit 7fd98fce 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 47778655d984
......@@ -1432,6 +1432,11 @@ def after_rename_repo
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 @@ def allowed_namespace?(user, namespace_id)
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 @@ def wiki_repo(project)
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