summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-11-24 11:31:59 +0000
committerPhil Hughes <me@iamphill.com>2016-11-24 11:31:59 +0000
commit79a791a30d60d04be34d0e6d36c9cc145b97635b (patch)
tree7495834ed7bdfb51946c5f40fc61f1568ff0f823 /app/models/commit.rb
parentfa04393482eff8d7d7cdb71c3bdea2c918a49a57 (diff)
parent3e44ed3e2bf75bb14a2d8b0466b3d92afd0ea067 (diff)
downloadgitlab-ce-menu-resize-hide.tar.gz
Merge branch 'master' into menu-resize-hidemenu-resize-hide
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index e64fd1e0c1b..9e7fde9503d 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -226,12 +226,19 @@ class Commit
end
def pipelines
- @pipeline ||= project.pipelines.where(sha: sha)
+ project.pipelines.where(sha: sha)
end
- def status
- return @status if defined?(@status)
- @status ||= pipelines.status
+ def status(ref = nil)
+ @statuses ||= {}
+
+ if @statuses.key?(ref)
+ @statuses[ref]
+ elsif ref
+ @statuses[ref] = pipelines.where(ref: ref).status
+ else
+ @statuses[ref] = pipelines.status
+ end
end
def revert_branch_name