Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2019-01-11 16:30:25 +0300
committerGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-01-15 02:59:47 +0300
commit740f64c77b5621356be5fe8ff48aa08b860d9c0b (patch)
tree86303a6a14e7cb275bb2db2998c22b99d63f13c9 /app
parentf623c2f2d9376d2c7b4f5fc2427f3fd4c6ca8844 (diff)
Merge branch 'fix-udpate-head-pipeline-method' into 'master'
Fix unexpected exception by failure of finding an actual head pipeline Closes #56113 See merge request gitlab-org/gitlab-ce!24257 (cherry picked from commit 3ce491c5a065be80856e1f8d5097caba7ea8dd5d) 1c248cd4 Fix unexpected exception by failed to find an actual head pipeline
Diffstat (limited to 'app')
-rw-r--r--app/models/merge_request.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index f220fa705ce..237b01636fb 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -1102,9 +1102,10 @@ class MergeRequest < ActiveRecord::Base
end
def update_head_pipeline
- self.head_pipeline = find_actual_head_pipeline
-
- update_column(:head_pipeline_id, head_pipeline.id) if head_pipeline_id_changed?
+ find_actual_head_pipeline.try do |pipeline|
+ self.head_pipeline = pipeline
+ update_column(:head_pipeline_id, head_pipeline.id) if head_pipeline_id_changed?
+ end
end
def merge_request_pipeline_exists?