diff options
author | Stan Hu <stanhu@gmail.com> | 2018-11-01 07:50:39 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-11-01 07:50:39 -0700 |
commit | de1db4972cff7539b4ed490e9ebaf87f06500bbd (patch) | |
tree | 854c51fb38707ffaab3095dde074bbbabf6225ee /lib | |
parent | 0844ba04b518b4cd0a326a2ee0e8431eeb26950d (diff) | |
download | gitlab-ce-de1db4972cff7539b4ed490e9ebaf87f06500bbd.tar.gz |
Avoidp loading merge request diff files when not needed
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/diff/file_collection/base.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/gitlab/diff/file_collection/base.rb b/lib/gitlab/diff/file_collection/base.rb index b79ff771a2b..2ad6fe8449d 100644 --- a/lib/gitlab/diff/file_collection/base.rb +++ b/lib/gitlab/diff/file_collection/base.rb @@ -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) |