Update project full path in .git/config when renaming a repository

This commit is contained in:
Douglas Barbosa Alexandre 2017-12-19 14:53:59 -02:00
parent 9504a529b7
commit 64fe954dce
3 changed files with 20 additions and 1 deletions

View File

@ -1420,6 +1420,11 @@ class Project < ActiveRecord::Base
end
def after_rename_repo
# 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.
write_repository_config(:fullpath, full_path)
path_before_change = previous_changes['path'].first
# We need to check if project had been rolled out to move resource to hashed storage or not and decide

View File

@ -2626,6 +2626,14 @@ describe Project do
project.rename_repo
end
end
it 'updates project full path in .git/config' do
allow(project_storage).to receive(:rename_repo).and_return(true)
expect(project).to receive(:write_repository_config).with(:fullpath, project.full_path)
project.rename_repo
end
end
describe '#pages_path' do
@ -2781,6 +2789,12 @@ describe Project do
end
end
end
it 'updates project full path in .git/config' do
expect(project).to receive(:write_repository_config).with(:fullpath, project.full_path)
project.rename_repo
end
end
describe '#pages_path' do

View File

@ -61,7 +61,7 @@ describe Projects::UpdateService do
end
end
context 'When project visibility is higher than parent group' do
context 'when project visibility is higher than parent group' do
let(:group) { create(:group, visibility_level: Gitlab::VisibilityLevel::INTERNAL) }
before do