diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-11-13 15:34:51 +0100 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-11-13 15:34:51 +0100 |
commit | 4e65d085b50844469a322d46773de04c16159ce1 (patch) | |
tree | 08385c2a5c9fcea310d119cb200f0b9f1e8f2252 /lib | |
parent | 6adc313a1f48809543c626aa226ad56979cdde99 (diff) | |
parent | 4a5044e30269f8b3c6c075093cd4646a478231c7 (diff) | |
download | gitlab-ce-4e65d085b50844469a322d46773de04c16159ce1.tar.gz |
Merge pull request #8299 from dandric-activevideo/bug8271
Fix for #8271: Correctly restore empty repositories.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/backup/repository.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb index 0bb02f1a357..faa1b3b4099 100644 --- a/lib/backup/repository.rb +++ b/lib/backup/repository.rb @@ -59,7 +59,13 @@ module Backup project.namespace.ensure_dir_exist if project.namespace - if system(*%W(git clone --bare #{path_to_bundle(project)} #{path_to_repo(project)}), silent) + if File.exists?(path_to_bundle(project)) + cmd = %W(git clone --bare #{path_to_bundle(project)} #{path_to_repo(project)}) + else + cmd = %W(git init --bare #{path_to_repo(project)}) + end + + if system(*cmd, silent) puts "[DONE]".green else puts "[FAILED]".red |