summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-04-04 16:40:58 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-04-05 10:21:51 +0200
commit48b17e991a960c006da278d4c1f534b1db81d070 (patch)
treed4746354205a4695d87143082b560b6b5efac7cb /lib
parent10d0f438d823418a4a4f4e4f52e8f35ed10f2a05 (diff)
downloadgitlab-ce-48b17e991a960c006da278d4c1f534b1db81d070.tar.gz
Add helper for accessing lfs_objects for project
This makes accessing LFS Objects for a project easier project.lfs_storage_project.lfs_objects` becomes project.all_lfs_objects This will make the refactor in https://gitlab.com/gitlab-org/gitlab-ce/issues/39769 easier to deal with.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/checks/lfs_integrity.rb3
-rw-r--r--lib/gitlab/import_export/lfs_restorer.rb2
-rw-r--r--lib/gitlab/import_export/lfs_saver.rb4
3 files changed, 3 insertions, 6 deletions
diff --git a/lib/gitlab/checks/lfs_integrity.rb b/lib/gitlab/checks/lfs_integrity.rb
index f7276a380dc..f0e5773ec3c 100644
--- a/lib/gitlab/checks/lfs_integrity.rb
+++ b/lib/gitlab/checks/lfs_integrity.rb
@@ -15,8 +15,7 @@ module Gitlab
return false unless new_lfs_pointers.present?
- existing_count = @project.lfs_storage_project
- .lfs_objects
+ existing_count = @project.all_lfs_objects
.where(oid: new_lfs_pointers.map(&:lfs_oid))
.count
diff --git a/lib/gitlab/import_export/lfs_restorer.rb b/lib/gitlab/import_export/lfs_restorer.rb
index 4f144d5c8e6..b28c3c161b7 100644
--- a/lib/gitlab/import_export/lfs_restorer.rb
+++ b/lib/gitlab/import_export/lfs_restorer.rb
@@ -28,7 +28,7 @@ module Gitlab
lfs_object = LfsObject.find_or_initialize_by(oid: oid, size: size)
lfs_object.file = File.open(path) unless lfs_object.file&.exists?
- @project.lfs_storage_project.lfs_objects << lfs_object
+ @project.all_lfs_objects << lfs_object
end
def lfs_file_paths
diff --git a/lib/gitlab/import_export/lfs_saver.rb b/lib/gitlab/import_export/lfs_saver.rb
index 2e3b9ea200d..29410e2331c 100644
--- a/lib/gitlab/import_export/lfs_saver.rb
+++ b/lib/gitlab/import_export/lfs_saver.rb
@@ -9,9 +9,7 @@ module Gitlab
end
def save
- return true if @project.lfs_objects.empty?
-
- @project.lfs_storage_project.lfs_objects.each do |lfs_object|
+ @project.all_lfs_objects.each do |lfs_object|
save_lfs_object(lfs_object)
end