diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 06:07:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 06:07:52 +0300 |
commit | a0c1ba61c8e8c9195e3ad4deefc5c4cb5c6a1501 (patch) | |
tree | 0731210fac047fdfb04a8e907701e0efab8c897e /app/controllers/repositories | |
parent | 77237c5a6b9044f58beabc54d3589e5fa09cbfba (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/repositories')
-rw-r--r-- | app/controllers/repositories/lfs_api_controller.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/app/controllers/repositories/lfs_api_controller.rb b/app/controllers/repositories/lfs_api_controller.rb index b1e0d1848d7..f93038f455e 100644 --- a/app/controllers/repositories/lfs_api_controller.rb +++ b/app/controllers/repositories/lfs_api_controller.rb @@ -45,15 +45,9 @@ module Repositories params[:operation] == 'upload' end - # rubocop: disable CodeReuse/ActiveRecord - def existing_oids - @existing_oids ||= begin - project.all_lfs_objects.where(oid: objects.map { |o| o['oid'].to_s }).pluck(:oid) - end - end - # rubocop: enable CodeReuse/ActiveRecord - def download_objects! + existing_oids = project.all_lfs_objects_oids(oids: objects_oids) + objects.each do |object| if existing_oids.include?(object[:oid]) object[:actions] = download_actions(object) @@ -68,13 +62,17 @@ module Repositories } end end + objects end def upload_objects! + existing_oids = project.lfs_objects_oids(oids: objects_oids) + objects.each do |object| object[:actions] = upload_actions(object) unless existing_oids.include?(object[:oid]) end + objects end |