Fixed styles, ProjectHook specs etc

This commit is contained in:
Dmitriy Zaporozhets 2013-01-05 00:35:38 +02:00
parent c6298678f5
commit e16cebac3e
22 changed files with 111 additions and 76 deletions

View file

@ -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

View file

@ -361,8 +361,8 @@ class Project < ActiveRecord::Base
# Discover the default branch, but only if it hasn't already been set to
# something else
if default_branch.nil?
update_attributes(default_branch: discover_default_branch)
if repository && default_branch.nil?
update_attributes(default_branch: self.repository.discover_default_branch)
end
end