diff options
author | Luke Duncalfe <lduncalfe@eml.cc> | 2019-07-16 15:31:44 +1200 |
---|---|---|
committer | Luke Duncalfe <lduncalfe@eml.cc> | 2019-09-06 14:18:45 +1200 |
commit | 55ad5423eea6281657e1f7c6630774934f1f26b9 (patch) | |
tree | df72e6ee436c1504e4bbb55b3e1474b84c81087f /lib/gitlab/import_export/repo_saver.rb | |
parent | 8e49c2338a4cc9664e5f8fe454077a7a4021240c (diff) | |
download | gitlab-ce-55ad5423eea6281657e1f7c6630774934f1f26b9.tar.gz |
CE-specific changes to allow design repo exports11090-project-export-design-repository-ce
https://gitlab.com/gitlab-org/gitlab-ee/issues/11090
Diffstat (limited to 'lib/gitlab/import_export/repo_saver.rb')
-rw-r--r-- | lib/gitlab/import_export/repo_saver.rb | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/gitlab/import_export/repo_saver.rb b/lib/gitlab/import_export/repo_saver.rb index a60618dfcec..898cd7898ba 100644 --- a/lib/gitlab/import_export/repo_saver.rb +++ b/lib/gitlab/import_export/repo_saver.rb @@ -5,27 +5,35 @@ module Gitlab class RepoSaver include Gitlab::ImportExport::CommandLineUtil - attr_reader :full_path + attr_reader :project, :repository, :shared def initialize(project:, shared:) @project = project @shared = shared + @repository = @project.repository end def save - return true if @project.empty_repo? # it's ok to have no repo + return true unless repository_exists? # it's ok to have no repo - @full_path = File.join(@shared.export_path, ImportExport.project_bundle_filename) bundle_to_disk end private + def repository_exists? + repository.exists? && !repository.empty? + end + + def bundle_full_path + File.join(shared.export_path, ImportExport.project_bundle_filename) + end + def bundle_to_disk - mkdir_p(@shared.export_path) - @project.repository.bundle_to_disk(@full_path) + mkdir_p(shared.export_path) + repository.bundle_to_disk(bundle_full_path) rescue => e - @shared.error(e) + shared.error(e) false end end |