Commit b0c71fea authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜 Committed by GStreamer Marge Bot
Browse files

cerbero: Don't try to git commit if nothing to commit

git commit will fail if there's nothing to commit. This can happen if
all the commands in the extract step completed successfully, but the
step was marked as failed or was cancelled. In that case, the step
will be tried again and since all commands will be idempotent, there
won't be anything to commit.

Check whether we need to commit before trying to commit.

Part-of: <!622>
parent 417f541a
......@@ -271,7 +271,12 @@ def init_directory(git_dir, logfile=None):
'''
init(git_dir, logfile=logfile)
shell.new_call([GIT, 'add', '--force', '-A', '.'], git_dir, logfile=logfile)
shell.new_call([GIT, 'commit', '-m', 'Initial commit'], git_dir, logfile=logfile)
# Check if we need to commit anything. This can happen when extract failed
# or was cancelled somehow last time but the source tree was setup
# correctly and git commit succeeded.
ret = shell.new_call([GIT, 'diff', '--quiet', 'HEAD'], git_dir, logfile=logfile, fail=False)
if ret > 0:
shell.new_call([GIT, 'commit', '-m', 'Initial commit'], git_dir, logfile=logfile)
def apply_patch(patch, git_dir, logfile=None):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment