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

parent 9504a529
...@@ -1420,6 +1420,11 @@ class Project < ActiveRecord::Base ...@@ -1420,6 +1420,11 @@ class Project < ActiveRecord::Base
end end
def after_rename_repo 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 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 # We need to check if project had been rolled out to move resource to hashed storage or not and decide
......
...@@ -2626,6 +2626,14 @@ describe Project do ...@@ -2626,6 +2626,14 @@ describe Project do
project.rename_repo project.rename_repo
end end
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 end
describe '#pages_path' do describe '#pages_path' do
...@@ -2781,6 +2789,12 @@ describe Project do ...@@ -2781,6 +2789,12 @@ describe Project do
end end
end 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 end
describe '#pages_path' do describe '#pages_path' do
......
...@@ -61,7 +61,7 @@ describe Projects::UpdateService do ...@@ -61,7 +61,7 @@ describe Projects::UpdateService do
end end
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) } let(:group) { create(:group, visibility_level: Gitlab::VisibilityLevel::INTERNAL) }
before do before do
......
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