Avoidp loading merge request diff files when not needed
This commit is contained in:
parent
0844ba04b5
commit
de1db4972c
2 changed files with 6 additions and 3 deletions
|
@ -38,7 +38,7 @@ module MergeRequests
|
|||
# reloading the diff.
|
||||
MergeRequestDiff
|
||||
.where(merge_request: merge_request)
|
||||
.preload(:merge_request_diff_files, merge_request: :target_project)
|
||||
.preload(merge_request: :target_project)
|
||||
.find_each do |merge_request_diff|
|
||||
next if merge_request_diff == new_diff
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ module Gitlab
|
|||
|
||||
@diffable = diffable
|
||||
@include_stats = diff_options.delete(:include_stats)
|
||||
@diffs = diffable.raw_diffs(diff_options)
|
||||
@project = project
|
||||
@diff_options = diff_options
|
||||
@diff_refs = diff_refs
|
||||
|
@ -25,8 +24,12 @@ module Gitlab
|
|||
@repository = project.repository
|
||||
end
|
||||
|
||||
def diffs
|
||||
@diffs ||= diffable.raw_diffs(diff_options)
|
||||
end
|
||||
|
||||
def diff_files
|
||||
@diff_files ||= @diffs.decorate! { |diff| decorate_diff!(diff) }
|
||||
@diff_files ||= diffs.decorate! { |diff| decorate_diff!(diff) }
|
||||
end
|
||||
|
||||
def diff_file_with_old_path(old_path)
|
||||
|
|
Loading…
Reference in a new issue