summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPavel Shutsin <pshutsin@gitlab.com>2019-08-13 11:26:16 +0300
committerPavel Shutsin <pshutsin@gitlab.com>2019-09-04 13:01:55 +0300
commitf089a230159d262be8ac97c57b10086434b9c80d (patch)
treececc8042f9a27c08132a756abdb675e5f360132a /app
parentfd561023c4186226526f4d3ccf87b8a1924a5773 (diff)
downloadgitlab-ce-f089a230159d262be8ac97c57b10086434b9c80d.tar.gz
Backport EE changes for productivity analytics
Improve diff lines count efficiency
Diffstat (limited to 'app')
-rw-r--r--app/models/merge_request_diff.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb
index 2402fa8e38f..4db2b7a74e5 100644
--- a/app/models/merge_request_diff.rb
+++ b/app/models/merge_request_diff.rb
@@ -197,7 +197,7 @@ class MergeRequestDiff < ApplicationRecord
def lines_count
strong_memoize(:lines_count) do
- diffs.diff_files.sum(&:line_count)
+ raw_diffs(limits: false).line_count
end
end
@@ -222,6 +222,10 @@ class MergeRequestDiff < ApplicationRecord
commits.last
end
+ def last_commit
+ commits.first
+ end
+
def base_commit
return unless base_commit_sha