From 46e3579673939c69c8a945f1834075a8d899d1c6 Mon Sep 17 00:00:00 2001 From: Yee <2520865+yixinglu@users.noreply.github.com> Date: Mon, 11 Apr 2022 23:40:52 +0800 Subject: [PATCH] Cherry pick empty commit (#29) --- main.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index 58a3e2e..fc465bb 100755 --- a/main.py +++ b/main.py @@ -114,14 +114,17 @@ def apply_patch(branch, comm_ci): git('cherry-pick', git_commit.sha) except sh.ErrorReturnCode as e: err = str(e) - print(">>> Fail to apply the patch to branch {}, cause: {}".format(branch, err)) - if err.find('more, please see e.stdout') >= 0: - err = e.stdout.decode() - conflict_files = conflict_file_list(err.splitlines()) - # git('cherry-pick', '--abort') - # overwrite_conflict_files(git_commit) - commit_changes(comm_ci) - stopped = True + if err.find('git commit --allow-empty') >= 0: + git('commit', '--allow-empty', '--allow-empty-message', '--no-edit') + else: + print(">>> Fail to apply the patch to branch {}, cause: {}".format(branch, err)) + if err.find('more, please see e.stdout') >= 0: + err = e.stdout.decode() + conflict_files = conflict_file_list(err.splitlines()) + # git('cherry-pick', '--abort') + # overwrite_conflict_files(git_commit) + commit_changes(comm_ci) + stopped = True try: git.push("-u", "origin", branch)