diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 18:09:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 18:09:36 +0300 |
commit | 074d013e1eb3f6e0c27f96a3be8b9361254c8a98 (patch) | |
tree | f185c474ddc8624a4793c84b0b1f4cc07349694b /app/models/merge_request.rb | |
parent | 8f9beefac3774b30e911fb00a68f4c7a5244cf27 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 412d0fa4ec8..bb7afc49cd8 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -410,8 +410,16 @@ class MergeRequest < ApplicationRecord "#{project.to_reference_base(from, full: full)}#{reference}" end - def context_commits - @context_commits ||= merge_request_context_commits.map(&:to_commit) + def context_commits(limit: nil) + @context_commits ||= merge_request_context_commits.limit(limit).map(&:to_commit) + end + + def recent_context_commits + context_commits(limit: MergeRequestDiff::COMMITS_SAFE_SIZE) + end + + def context_commits_count + context_commits.count end def commits(limit: nil) |