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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-02 09:08:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-02 09:08:56 +0300
commit208e2e308c444624e1d864c936ad7fe178ffc7e9 (patch)
tree3d779cbf4c44a77417cef8f4764adf6e8a7316da /lib/gitlab/diff
parent78214bf7421d73e288466100df584d99e91154af (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/diff')
-rw-r--r--lib/gitlab/diff/file.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb
index 2ba38f31720..17a7be311ca 100644
--- a/lib/gitlab/diff/file.rb
+++ b/lib/gitlab/diff/file.rb
@@ -350,6 +350,16 @@ module Gitlab
private
+ def fetch_blob(sha, path)
+ return unless sha
+
+ # Load only patch_hard_limit_bytes number of bytes for the blob
+ # Because otherwise, it is too large to be displayed
+ Blob.lazy(
+ repository.project, sha, path,
+ blob_size_limit: Gitlab::Git::Diff.patch_hard_limit_bytes)
+ end
+
def total_blob_lines(blob)
@total_lines ||= begin
line_count = blob.lines.size
@@ -385,15 +395,11 @@ module Gitlab
end
def new_blob_lazy
- return unless new_content_sha
-
- Blob.lazy(repository.project, new_content_sha, file_path)
+ fetch_blob(new_content_sha, file_path)
end
def old_blob_lazy
- return unless old_content_sha
-
- Blob.lazy(repository.project, old_content_sha, old_path)
+ fetch_blob(old_content_sha, old_path)
end
def simple_viewer_class