summaryrefslogtreecommitdiff
path: root/app/models/ci/commit.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-04-26 16:36:17 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-04-26 16:36:17 +0200
commitcb90368a692149b4e01b50d7c6682c48cffa438b (patch)
tree6236d6f4fd56acad1015950d483db0ba8fa3ada9 /app/models/ci/commit.rb
parentc6f19aed51736e5945283a611eae09f32a9b5aeb (diff)
parentf127edd012bd8b6f76ac67d69aadbd7d4837258f (diff)
downloadgitlab-ce-cb90368a692149b4e01b50d7c6682c48cffa438b.tar.gz
Merge remote-tracking branch 'origin/master' into with-pipeline-view
Diffstat (limited to 'app/models/ci/commit.rb')
-rw-r--r--app/models/ci/commit.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index 6abeddeeae6..fadf5c62984 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -19,14 +19,17 @@
module Ci
class Commit < ActiveRecord::Base
extend Ci::Model
- include CiStatus
+ include Statuseable
belongs_to :project, class_name: '::Project', foreign_key: :gl_project_id
has_many :statuses, class_name: 'CommitStatus'
has_many :builds, class_name: 'Ci::Build'
has_many :trigger_requests, dependent: :destroy, class_name: 'Ci::TriggerRequest'
+ delegate :stages, to: :statuses
+
validates_presence_of :sha
+ validates_presence_of :status
validate :valid_commit_sha
# Invalidate object and save if when touched
@@ -40,10 +43,6 @@ module Ci
CommitStatus.where(commit: all).stages
end
- def stages
- statuses.stages
- end
-
def project_id
project.id
end
@@ -82,7 +81,7 @@ module Ci
def retryable?
builds.latest.any? do |build|
- build.failed? || build.retryable?
+ build.failed? && build.retryable?
end
end