summaryrefslogtreecommitdiff
path: root/app/services/bulk_imports/tree_export_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/bulk_imports/tree_export_service.rb')
-rw-r--r--app/services/bulk_imports/tree_export_service.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/services/bulk_imports/tree_export_service.rb b/app/services/bulk_imports/tree_export_service.rb
index b8e7ac4574b..8e885e590d1 100644
--- a/app/services/bulk_imports/tree_export_service.rb
+++ b/app/services/bulk_imports/tree_export_service.rb
@@ -10,6 +10,8 @@ module BulkImports
end
def execute
+ return serializer.serialize_root(config.class::SELF_RELATION) if self_relation?
+
relation_definition = config.tree_relation_definition_for(relation)
raise BulkImports::Error, 'Unsupported relation export type' unless relation_definition
@@ -18,6 +20,8 @@ module BulkImports
end
def exported_filename
+ return "#{relation}.json" if self_relation?
+
"#{relation}.ndjson"
end
@@ -39,5 +43,9 @@ module BulkImports
def json_writer
::Gitlab::ImportExport::Json::NdjsonWriter.new(export_path)
end
+
+ def self_relation?
+ relation == config.class::SELF_RELATION
+ end
end
end