diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-10-21 10:24:06 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-10-21 10:24:06 +0200 |
commit | d37cf6423759e445f0bff5121eb1ed1467ae0fd1 (patch) | |
tree | a82936658ac1058e96d535af7ef17ca0eb5bf790 /app/models/commit.rb | |
parent | d9944fdb59fe286022130f133f316b80dec04ea6 (diff) | |
parent | 35618a3dfffe546744123bcaf560ba9f74c42eef (diff) | |
download | gitlab-ce-d37cf6423759e445f0bff5121eb1ed1467ae0fd1.tar.gz |
Merge branch 'master' into hanloong/gitlab-ce-add-dates-snippets-show
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index d5c50013525..492f6be1ce3 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -2,13 +2,13 @@ class Commit extend ActiveModel::Naming include ActiveModel::Conversion - include Mentionable include Participable + include Mentionable include Referable include StaticModel attr_mentionable :safe_message - participant :author, :committer, :notes, :mentioned_users + participant :author, :committer, :notes attr_accessor :project @@ -164,6 +164,14 @@ class Commit @committer ||= User.find_by_any_email(committer_email) end + def parents + @parents ||= parent_ids.map { |id| project.commit(id) } + end + + def parent + @parent ||= project.commit(self.parent_id) if self.parent_id + end + def notes project.notes.for_commit_id(self.id) end @@ -181,10 +189,6 @@ class Commit @raw.short_id(7) end - def parents - @parents ||= Commit.decorate(super, project) - end - def ci_commit project.ci_commit(sha) end |