Commit 4d118fa0 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '118783-restoring-wikis-fails' into 'master'

Fix backup restoration with pre-existing wiki

See merge request gitlab-org/gitlab!24394
parents 02e105d6 f94b30a3
---
title: Fix backup restoration with pre-existing wiki
merge_request: 24394
author:
type: fixed
......@@ -96,6 +96,7 @@ module Backup
end
wiki = ProjectWiki.new(project)
wiki.repository.remove rescue nil
path_to_wiki_bundle = path_to_bundle(wiki)
if File.exist?(path_to_wiki_bundle)
......
......@@ -86,6 +86,22 @@ describe Backup::Repository do
expect(pool_repository.object_pool.exists?).to be(true)
end
end
it 'cleans existing repositories' do
wiki_repository_spy = spy(:wiki)
allow_next_instance_of(ProjectWiki) do |project_wiki|
allow(project_wiki).to receive(:repository).and_return(wiki_repository_spy)
end
expect_next_instance_of(Repository) do |repo|
expect(repo).to receive(:remove)
end
subject.restore
expect(wiki_repository_spy).to have_received(:remove)
end
end
describe '#empty_repo?' 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