summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-06-21 14:43:37 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-06-21 14:43:37 +0200
commit92984783db82e98cae06c08c680fd9c766ac52f8 (patch)
tree5d5cae41b26f000f6c420e1a4c8fb28bd61e3ab5 /app/models
parentd9a64e9f4107c68257db7dc76d25e5ecc883d7b1 (diff)
downloadgitlab-ce-92984783db82e98cae06c08c680fd9c766ac52f8.tar.gz
Rename commit_data in Pipeline to commitfix/builds-api-nil-commit
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/pipeline.rb8
-rw-r--r--app/models/commit_status.rb10
2 files changed, 6 insertions, 12 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 5b264ecffc5..ca5a685dd11 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -37,22 +37,22 @@ module Ci
end
def git_author_name
- commit_data.author_name if commit_data
+ commit.try(:author_name)
end
def git_author_email
- commit_data.author_email if commit_data
+ commit.try(:author_email)
end
def git_commit_message
- commit_data.message if commit_data
+ commit.try(:message)
end
def short_sha
Ci::Pipeline.truncate_sha(sha)
end
- def commit_data
+ def commit
@commit ||= project.commit(sha)
rescue
nil
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index bb74ff2c5f6..e437e3417a8 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -8,6 +8,8 @@ class CommitStatus < ActiveRecord::Base
belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :commit_id, touch: true
belongs_to :user
+ delegate :commit, to: :pipeline
+
validates :pipeline, presence: true, unless: :importing?
validates_presence_of :name
@@ -90,12 +92,4 @@ class CommitStatus < ActiveRecord::Base
def stuck?
false
end
-
- ##
- # Deprecated, this should be removed in 9.0 in favor of exposing
- # entire pipeline in API.
- #
- def commit
- pipeline.try(:commit_data)
- end
end