Prevent bad commits deploying.
In the event of a fatal error occuring when trying to add content to git for commit, you end up pushing a blank commit to the git respository. This is a change which halts the push to a git repository so you don't accidentally take down your website.
This commit is contained in:
parent
b84f69f54a
commit
79d86af7be
1 changed files with 8 additions and 3 deletions
|
@ -37,9 +37,14 @@ module Middleman
|
|||
def commit_branch(options = '')
|
||||
message = self.commit_message ? self.commit_message : add_signature_to_commit_message('Automated commit')
|
||||
|
||||
`git add -A`
|
||||
`git commit --allow-empty -am "#{message}"`
|
||||
`git push #{options} origin #{self.branch}`
|
||||
run_or_fail("git add -A")
|
||||
run_or_fail("git commit --allow-empty -am \"#{message}\"")
|
||||
run_or_fail("git push #{options} origin #{self.branch}")
|
||||
end
|
||||
|
||||
private
|
||||
def run_or_fail(command)
|
||||
system(command) || raise("ERROR running: #{command}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue