diff options
author | James Lopez <james@jameslopez.es> | 2017-09-06 08:56:38 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-09-06 08:56:38 +0200 |
commit | 7e38cc9cc215682fc20a7c036dee763df4409198 (patch) | |
tree | 6711653ee1fbf9b8ac0d6d799afc62fc887abef3 | |
parent | a685298620ef1c470c848c5ff6122d34d4213cc2 (diff) | |
download | gitlab-ce-7e38cc9cc215682fc20a7c036dee763df4409198.tar.gz |
small refactor
-rw-r--r-- | lib/gitlab/import_export/project_tree_restorer.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/gitlab/import_export/project_tree_restorer.rb b/lib/gitlab/import_export/project_tree_restorer.rb index d365e9ad40b..f8775729bef 100644 --- a/lib/gitlab/import_export/project_tree_restorer.rb +++ b/lib/gitlab/import_export/project_tree_restorer.rb @@ -10,7 +10,7 @@ module Gitlab @shared = shared @project = project @project_id = project.id - @saved = [] + @saved = true end def restore @@ -63,16 +63,16 @@ module Gitlab end end - @saved.all? + @saved end def save_relation_hash(relation_hash_batch, relation_key) relation_hash = create_relation(relation_key, relation_hash_batch) - @saved << restored_project.append_or_update_attribute(relation_key, relation_hash) + @saved = false unless restored_project.append_or_update_attribute(relation_key, relation_hash) - # Restore the project again, extra query but let us skip holding the AR objects in memory - @restored_project = Project.find(@project_id) + # Restore the project again, extra query that skips holding the AR objects in memory + @restored_project.reload end def default_relation_list |