diff --git a/CHANGELOG b/CHANGELOG index fd902050913384780834d15cceb861f1e5dfff72..18c559ecc1761eaf5d482b51ebc847da4ef969ca 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,7 +2,7 @@ v 7.6.0 - Fork repository to groups - New rugged version - Add CRON=1 backup setting for quiet backups - - + - Fix failing wiki restore - - Add optional Sidekiq MemoryKiller middleware (enabled via SIDEKIQ_MAX_RSS env variable) - diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb index f39fba23cf58014b17b8b314e2e0690186901f32..6b04b23cf4691c2b1a2be4a80fbf449248aabd49 100644 --- a/lib/backup/repository.rb +++ b/lib/backup/repository.rb @@ -79,16 +79,20 @@ module Backup wiki = ProjectWiki.new(project) + $progress.print " * #{wiki.path_with_namespace} ... " + if File.exists?(path_to_bundle(wiki)) - $progress.print " * #{wiki.path_with_namespace} ... " cmd = %W(git clone --bare #{path_to_bundle(wiki)} #{path_to_repo(wiki)}) - if system(*cmd, silent) - $progress.puts " [DONE]".green - else - puts " [FAILED]".red - puts "failed: #{cmd.join(' ')}" - abort 'Restore failed' - end + else + cmd = %W(git init --bare #{path_to_repo(wiki)}) + end + + if system(*cmd, silent) + $progress.puts " [DONE]".green + else + puts " [FAILED]".red + puts "failed: #{cmd.join(' ')}" + abort 'Restore failed' end end