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

Use temporary compare commits when MR not persisted

parent f7da5065
......@@ -787,21 +787,19 @@ class MergeRequest < ActiveRecord::Base
def all_pipelines
return unless source_project
@all_pipelines ||= begin
sha = if persisted?
all_commits_sha
else
diff_head_sha
end
source_project.pipelines.order(id: :desc).
where(sha: sha, ref: source_branch)
end
@all_pipelines ||= source_project.pipelines
.where(sha: all_commits_sha, ref: source_branch)
.order(id: :desc)
end
# Note that this could also return SHA from now dangling commits
#
def all_commits_sha
if persisted?
merge_request_diffs.flat_map(&:commits_sha).uniq
else
compare_commits.reverse.map(&:id)
end
end
def merge_commit
......
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