prevent app crash for events without git resources
This commit is contained in:
parent
f1799a239f
commit
c9db6bb3f2
2 changed files with 17 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue