I'm trying to write a fabric script that does a git commit
; however, if there is nothing to commit, git exits with a status of 1
. The deploy script takes that as unsuccessful, and quits. I do want to detect actual failures-to-commit, so I can't just give fabric a blanket ignore for git commit
failures. How can I allow empty-commit failures to be ignored so that deploy can continue, but still catch errors caused when a real commit fails?
def commit():
local("git add -p && git commit")