Commit 72d84e48 authored by Grzegorz Bizon's avatar Grzegorz Bizon Committed by Annabel Dunstone Gray

Improve code that creates a list of commits for MR

parent ab8ef17f
......@@ -797,9 +797,10 @@ class MergeRequest < ActiveRecord::Base
def all_commits_sha
if persisted?
merge_request_diffs.flat_map(&:commits_sha).uniq
elsif compare_commits
compare_commits.to_a.reverse.map(&:id)
else
cached_commits = compare_commits.to_a.reverse.map(&:id)
cached_commits.any? ? cached_commits : [diff_head_sha]
[diff_head_sha]
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment