diff options
author | Achilleas Pipinellis <axilleas@axilleas.me> | 2014-11-30 18:24:05 +0200 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-12-01 19:12:46 +0100 |
commit | 3215dc7116a22e26faa9b3090d3b0af4ba6d8a3d (patch) | |
tree | f5ddd5c98641f2b74abde9fdc338f73c719f028b | |
parent | 1e033c2ee65d0278876ae79eba6c943513fc7b64 (diff) | |
download | gitlab-ce-3215dc7116a22e26faa9b3090d3b0af4ba6d8a3d.tar.gz |
Properly fix wiki restore.
ProjectWiki.new() creates a new wiki git repository, so any tries
to bare clone a bundle fail. With this patch we remove the newly
created wiki.git before restoring from the backup bundle.
Conflicts:
lib/backup/repository.rb
-rw-r--r-- | lib/backup/repository.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb index faa1b3b4099..ceadeef57ef 100644 --- a/lib/backup/repository.rb +++ b/lib/backup/repository.rb @@ -55,7 +55,7 @@ module Backup FileUtils.mkdir_p(repos_path) Project.find_each(batch_size: 1000) do |project| - print "#{project.path_with_namespace} ... " + print " * #{project.path_with_namespace} ... " project.namespace.ensure_dir_exist if project.namespace @@ -76,10 +76,18 @@ module Backup if File.exists?(path_to_bundle(wiki)) print " * #{wiki.path_with_namespace} ... " - if system(*%W(git clone --bare #{path_to_bundle(wiki)} #{path_to_repo(wiki)}), silent) + + # If a wiki bundle exists, first remove the empty repo + # that was initialized with ProjectWiki.new() and then + # try to restore with 'git clone --bare'. + FileUtils.rm_rf(path_to_repo(wiki)) + cmd = %W(git clone --bare #{path_to_bundle(wiki)} #{path_to_repo(wiki)}) + + if system(*cmd, silent) puts " [DONE]".green else puts " [FAILED]".red + puts "failed: #{cmd.join(' ')}" abort 'Restore failed' end end |