prevent app crash for events without git resources

This commit is contained in:
Dmitriy Zaporozhets 2012-04-02 19:51:20 +03:00
parent f1799a239f
commit c9db6bb3f2
2 changed files with 17 additions and 3 deletions

View file

@ -63,5 +63,19 @@ module Event::PushTrait
"pushed to"
end
end
def parent_commit
commits.first.prev_commit
rescue => ex
nil
end
def last_commit
commits.last
end
def push_with_commits?
md_ref? && commits.any? && parent_commit && last_commit
end
end
end