summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-11-04 17:38:25 +0000
committerRémy Coutable <remy@rymai.me>2016-11-04 17:38:25 +0000
commit86b8fb4e7f376bdb70faf8ce99f34b6ec0fc8dc1 (patch)
tree72951de7ab61960d2fefa911fcf38b0548401ba8 /app/models/commit.rb
parent6eb77d9e5a6151570dd6b247b81e49f23ffd7770 (diff)
parent99410a4750b514b8d58a6d44f687ef29ecebc7cc (diff)
downloadgitlab-ce-86b8fb4e7f376bdb70faf8ce99f34b6ec0fc8dc1.tar.gz
Merge branch 'show-status-from-branch' into 'master'
Show pipeline status from branch and commit than only commit Closes #23615 See merge request !7034
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