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
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 069ea3f77b5..874692000b2 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -233,8 +233,15 @@ class Commit
@pipelines
end
+ # Passing the ref for this method makes sure we filter on commit and ref, so
+ # we can have better results as other pipeline status' won't influence the
+ # one you want
def status(ref = nil)
- pipelines(ref).last.try(:status)
+ if ref && pipelines(ref).any?
+ pipelines(ref).last.status
+ else
+ pipelines.status
+ end
end
def revert_branch_name