diff options
author | Pavel Shutsin <pshutsin@gitlab.com> | 2019-07-30 13:13:53 +0300 |
---|---|---|
committer | Pavel Shutsin <pshutsin@gitlab.com> | 2019-08-06 11:38:50 +0300 |
commit | 5b70ffcf14539c4984a9d278e673ab963e4412fd (patch) | |
tree | feefcc232b50ae08b05f659fad50f9b3d4580887 /app | |
parent | 55320ff69579f2dbe4ded1a88e7ff377d7a2eae9 (diff) |
Add MergeRequestDiff#lines_count convenience method
Diffstat (limited to 'app')
-rw-r--r-- | app/models/merge_request_diff.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index f45bd0e03de..2c9dbf2585c 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -196,6 +196,12 @@ class MergeRequestDiff < ApplicationRecord real_size.presence || raw_diffs.size end + def lines_count + strong_memoize(:lines_count) do + diffs.diff_files.sum(&:line_count) + end + end + def raw_diffs(options = {}) if options[:ignore_whitespace_change] @diffs_no_whitespace ||= compare.diffs(options) |