Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2016-11-02 17:23:46 +0300
committerAhmad Sherif <me@ahmadsherif.com>2016-11-04 16:59:53 +0300
commit6a9fb20fe157fba158a79d645742239796239124 (patch)
tree72eb61086598f61da6f60b4a04ceaf910f2fe77b /lib
parenta3cc2f1e8dfcfb2f3e181fa570ed2ba245f9a069 (diff)
Fix applying GitHub-imported labels when importing job is interrupted
Closes #24075
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/github_import/importer.rb10
1 files changed, 10 insertions, 0 deletions
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)