summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIgor Drozdov <idrozdov@gitlab.com>2019-03-20 20:23:23 +0300
committerIgor Drozdov <idrozdov@gitlab.com>2019-03-20 20:33:49 +0300
commit732f892db308863f2a2db736949c94ae9d613678 (patch)
treeebd669db3075e46f733dd348d2d95be624a586d2 /lib
parent37bd7aa6beffd1567dadcb4fff8167d050deabd8 (diff)
downloadgitlab-ce-732f892db308863f2a2db736949c94ae9d613678.tar.gz
Return cached languages if they've been detected before
Diffstat (limited to 'lib')
-rw-r--r--lib/api/projects.rb8
-rw-r--r--lib/gitlab/import_export/import_export.yml1
2 files changed, 4 insertions, 5 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 91501ba4d36..22c90e4e83e 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -392,11 +392,9 @@ module API
desc 'Get languages in project repository'
get ':id/languages' do
- if user_project.repository_languages.present?
- user_project.repository_languages.map { |l| [l.name, l.share] }.to_h
- else
- user_project.repository.languages.map { |language| language.values_at(:label, :value) }.to_h
- end
+ ::Projects::RepositoryLanguagesService
+ .new(user_project, current_user)
+ .execute.map { |lang| [lang.name, lang.share] }.to_h
end
desc 'Remove a project'
diff --git a/lib/gitlab/import_export/import_export.yml b/lib/gitlab/import_export/import_export.yml
index a0aab9fcbaf..d5a291dfa78 100644
--- a/lib/gitlab/import_export/import_export.yml
+++ b/lib/gitlab/import_export/import_export.yml
@@ -117,6 +117,7 @@ excluded_attributes:
- :description_html
- :repository_languages
- :bfg_object_map
+ - :detected_repository_languages
- :tag_list
namespaces:
- :runners_token