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