summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-09-06 11:11:02 +0200
committerJames Lopez <james@jameslopez.es>2017-09-06 11:11:02 +0200
commit9e1f8ac2a3edb32f672ef2ad5424e99425f67c92 (patch)
treeb7fd485153bfe6e88ac1e28c3805d4b29734d750
parente5f91e524628faab81c1d61ebcaa00eaf0954ff6 (diff)
downloadgitlab-ce-9e1f8ac2a3edb32f672ef2ad5424e99425f67c92.tar.gz
refactored code
-rw-r--r--lib/gitlab/import_export/project_tree_restorer.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/gitlab/import_export/project_tree_restorer.rb b/lib/gitlab/import_export/project_tree_restorer.rb
index dec8a4c8cab..3bc095a99a9 100644
--- a/lib/gitlab/import_export/project_tree_restorer.rb
+++ b/lib/gitlab/import_export/project_tree_restorer.rb
@@ -56,8 +56,7 @@ module Gitlab
if relation.is_a?(Hash)
create_sub_relations(relation, @tree_hash)
elsif @tree_hash[relation.to_s].present?
- relation_key = relation.is_a?(Hash) ? relation.keys.first : relation
- save_relation_hash(@tree_hash[relation_key.to_s], relation_key)
+ save_relation_hash(@tree_hash[relation.to_s], relation)
end
end
@@ -101,7 +100,7 @@ module Gitlab
# issue, finds any subrelations such as notes, creates them and assign them back to the hash
#
# Recursively calls this method if the sub-relation is a hash containing more sub-relations
- def create_sub_relations(relation, tree_hash, save = true)
+ def create_sub_relations(relation, tree_hash, save: true)
relation_key = relation.keys.first.to_s
return if tree_hash[relation_key].blank?
@@ -133,7 +132,7 @@ module Gitlab
# We just use author to get the user ID, do not attempt to create an instance.
next if sub_relation == :author
- create_sub_relations(sub_relation, relation_item, false) if sub_relation.is_a?(Hash)
+ create_sub_relations(sub_relation, relation_item, save: false) if sub_relation.is_a?(Hash)
relation_hash, sub_relation = assign_relation_hash(relation_item, sub_relation)
relation_item[sub_relation.to_s] = create_relation(sub_relation, relation_hash) unless relation_hash.blank?