Check if wiki repository exists before syncing it

parent 7acf1635
...@@ -92,13 +92,11 @@ module Geo ...@@ -92,13 +92,11 @@ module Geo
finished_at = nil finished_at = nil
begin begin
# Second .wiki call returns a Gollum::Wiki, and it will always create the physical repository when not found project.wiki.create_repo! unless project.wiki.repository_exists?
if project.wiki.wiki.exist? project.wiki.repository.fetch_geo_mirror(ssh_url_to_wiki)
project.wiki.repository.fetch_geo_mirror(ssh_url_to_wiki)
end
finished_at = DateTime.now finished_at = DateTime.now
rescue Gitlab::Shell::Error => e rescue Gitlab::Shell::Error, ProjectWiki::CouldNotCreateWikiError => e
Rails.logger.error("#{self.class.name}: Error syncing wiki repository for project #{project.path_with_namespace}: #{e}") Rails.logger.error("#{self.class.name}: Error syncing wiki repository for project #{project.path_with_namespace}: #{e}")
end 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