diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-05 02:35:38 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-05 02:35:38 +0400 |
commit | e16cebac3eaadc0df93576358f60ae4a498ce15f (patch) | |
tree | 986cf1f20647bf98808e8a14b0faf3c93d368463 /app/models/commit.rb | |
parent | c6298678f5032823130f5b2eb6fc1810cbb01a10 (diff) |
Fixed styles, ProjectHook specs etc
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index a1d89600126..7e64c0f6e82 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -98,6 +98,8 @@ class Commit end def initialize(raw_commit, head = nil) + raise "Nil as raw commit passed" unless raw_commit + @commit = raw_commit @head = head end @@ -136,7 +138,11 @@ class Commit end def prev_commit - parents.try :first + @prev_commit ||= if parents.present? + Commit.new(parents.first) + else + nil + end end def prev_commit_id |