Correctly restore empty repositories.
If a project is being restored, but there is no bundle file, the project was empty when it was backed up. In this case, just use git init --base to create a new bare repository.
This commit is contained in:
parent
6adc313a1f
commit
4a5044e302
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue