diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-02 09:08:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-02 09:08:56 +0300 |
commit | 208e2e308c444624e1d864c936ad7fe178ffc7e9 (patch) | |
tree | 3d779cbf4c44a77417cef8f4764adf6e8a7316da /app | |
parent | 78214bf7421d73e288466100df584d99e91154af (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/models/blob.rb | 4 | ||||
-rw-r--r-- | app/models/repository.rb | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/app/models/blob.rb b/app/models/blob.rb index 42ee00bc196..258006d8d2e 100644 --- a/app/models/blob.rb +++ b/app/models/blob.rb @@ -83,9 +83,9 @@ class Blob < SimpleDelegator new(blob, project) end - def self.lazy(project, commit_id, path) + def self.lazy(project, commit_id, path, blob_size_limit: Gitlab::Git::Blob::MAX_DATA_DISPLAY_SIZE) BatchLoader.for([commit_id, path]).batch(key: project.repository) do |items, loader, args| - args[:key].blobs_at(items).each do |blob| + args[:key].blobs_at(items, blob_size_limit: blob_size_limit).each do |blob| loader.call([blob.commit_id, blob.path], blob) if blob end end diff --git a/app/models/repository.rb b/app/models/repository.rb index ee919f844dc..e7ad38864c8 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -516,10 +516,12 @@ class Repository end # items is an Array like: [[oid, path], [oid1, path1]] - def blobs_at(items) + def blobs_at(items, blob_size_limit: Gitlab::Git::Blob::MAX_DATA_DISPLAY_SIZE) return [] unless exists? - raw_repository.batch_blobs(items).map { |blob| Blob.decorate(blob, project) } + raw_repository.batch_blobs(items, blob_size_limit: blob_size_limit).map do |blob| + Blob.decorate(blob, project) + end end def root_ref |