BigW Consortium Gitlab

Commit 72d84e48 by 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 ...@@ -797,9 +797,10 @@ class MergeRequest < ActiveRecord::Base
def all_commits_sha def all_commits_sha
if persisted? if persisted?
merge_request_diffs.flat_map(&:commits_sha).uniq merge_request_diffs.flat_map(&:commits_sha).uniq
elsif compare_commits
compare_commits.to_a.reverse.map(&:id)
else else
cached_commits = compare_commits.to_a.reverse.map(&:id) [diff_head_sha]
cached_commits.any? ? cached_commits : [diff_head_sha]
end end
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