Commit 307be4b5 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Introduce MergeRequest#all_commits_sha, feedback:

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6414#note_15746083
parent 54483462
...@@ -747,15 +747,16 @@ class MergeRequest < ActiveRecord::Base ...@@ -747,15 +747,16 @@ class MergeRequest < ActiveRecord::Base
def all_pipelines def all_pipelines
return unless source_project return unless source_project
@all_pipelines ||= begin @all_pipelines ||= source_project.pipelines.order(id: :desc).
if persisted? where(sha: all_commits_sha, ref: source_branch)
sha = merge_request_diffs.flat_map(&:commits_sha).uniq end
else
sha = diff_head_sha
end
source_project.pipelines.order(id: :desc). # Note that this would also return SHA from dangling commits
where(sha: sha, ref: source_branch) def all_commits_sha
if persisted?
merge_request_diffs.flat_map(&:commits_sha).uniq
else
[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