From 6a9fb20fe157fba158a79d645742239796239124 Mon Sep 17 00:00:00 2001 From: Ahmad Sherif Date: Wed, 2 Nov 2016 16:23:46 +0200 Subject: Fix applying GitHub-imported labels when importing job is interrupted Closes #24075 --- lib/gitlab/github_import/importer.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib') diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb index ecc28799737..bdabc71194d 100644 --- a/lib/gitlab/github_import/importer.rb +++ b/lib/gitlab/github_import/importer.rb @@ -59,6 +59,8 @@ module Gitlab end end end + + ensure_labels_are_cached end def import_milestones @@ -234,6 +236,14 @@ module Gitlab end end + def ensure_labels_are_cached + return unless @labels.empty? + + project.labels.select(:id, :title).find_each do |label| + @labels[label.title] = label.id + end + end + def fetch_resources(resource_type, *opts) return if imported?(resource_type) -- cgit v1.2.3