diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-12-21 17:43:58 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-12-21 17:43:58 +0100 |
commit | 17ed42e362032e3594ae1cf34e6a970be826bdca (patch) | |
tree | e87fec13bf16f3ed4c0638b933d21dfb067d523e /app/models | |
parent | 1be8a3e087efd8f7d7127a02fcabcfd7570b6e36 (diff) | |
parent | c43fbaab937815e44856fe9d8371759986024e42 (diff) | |
download | gitlab-ce-17ed42e362032e3594ae1cf34e6a970be826bdca.tar.gz |
Merge branch 'issue_3452'
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/build.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 470b97a3c0f..7b89fe069ea 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -135,6 +135,16 @@ module Ci predefined_variables + yaml_variables + project_variables + trigger_variables end + def merge_request + merge_requests = MergeRequest.includes(:merge_request_diff) + .where(source_branch: ref, source_project_id: commit.gl_project_id) + .reorder(iid: :asc) + + merge_requests.find do |merge_request| + merge_request.commits.any? { |ci| ci.id == commit.sha } + end + end + def project commit.project end |