summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-11-30 18:03:31 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-11-30 18:03:31 +0000
commit3dc986cff191a3db60d07b9a841275062b5eb3fa (patch)
tree3ac9a12b5fb1f386e193332de8200651ba32387c
parent05f40bbfc8548826ddcb8401fba727c7fc414cca (diff)
parent191aa9712eeb8fe39e8947dc681cefe4221044ec (diff)
downloadgitlab-ce-3dc986cff191a3db60d07b9a841275062b5eb3fa.tar.gz
Merge branch 'backup_restore' into 'master'
Properly fix wiki restore My previous patch didn't fix the restore issue (!247). 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. \cc @jacobvosmaer @dzaporozhets are you ok with this solution/hack? Relevant issues: #845 See merge request !248
-rw-r--r--lib/backup/repository.rb26
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb
index 6b04b23cf46..e18bc804437 100644
--- a/lib/backup/repository.rb
+++ b/lib/backup/repository.rb
@@ -59,7 +59,7 @@ module Backup
FileUtils.mkdir_p(repos_path)
Project.find_each(batch_size: 1000) do |project|
- $progress.print "#{project.path_with_namespace} ... "
+ $progress.print " * #{project.path_with_namespace} ... "
project.namespace.ensure_dir_exist if project.namespace
@@ -79,20 +79,22 @@ 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} ... "
+
+ # 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)})
- 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'
+ if system(*cmd, silent)
+ $progress.puts " [DONE]".green
+ else
+ puts " [FAILED]".red
+ puts "failed: #{cmd.join(' ')}"
+ abort 'Restore failed'
+ end
end
end