Commit 3632f7e4 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'hot-fix-define-pipeline-vars' into 'master'

Do not use MergeRequest#commits in define_pipelines_vars

## What does this MR do?

`MergeRequest#commits` requires merge_request_diff to be present.
This is not the case when creating a new merge request.

## What are the relevant issue numbers?

Fix up for https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7568

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/24798

See merge request !7664
parents 45d69bf1 d7bd8f12
......@@ -563,11 +563,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def define_pipelines_vars
@pipelines = @merge_request.all_pipelines
if @pipelines.present? && @merge_request.commits.present?
@pipeline = @pipelines.first
@statuses = @pipeline.statuses.relevant
end
@pipeline = @merge_request.pipeline
@statuses = @pipeline.statuses.relevant if @pipeline.present?
end
def define_new_vars
......
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