summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-05 00:35:38 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-05 00:35:38 +0200
commite16cebac3eaadc0df93576358f60ae4a498ce15f (patch)
tree986cf1f20647bf98808e8a14b0faf3c93d368463 /app/models/commit.rb
parentc6298678f5032823130f5b2eb6fc1810cbb01a10 (diff)
downloadgitlab-ce-e16cebac3eaadc0df93576358f60ae4a498ce15f.tar.gz
Fixed styles, ProjectHook specs etc
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb8
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