From d0ff9d5796c5c64d28ee1274d48013410f6e5244 Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Fri, 29 Jan 2021 22:24:45 +0300 Subject: [PATCH] job.py: don't hard-code branch in error-handling When MR was created against a branch different from master and ended up with conflicts, bot goes into infinite loop due to getting inside error-handling path a: fatal: invalid reference: master Fix this by not hard-coding the master name. Signed-off-by: Konstantin Kharlamov --- marge/job.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/marge/job.py b/marge/job.py index 0646518f..5eeffd32 100644 --- a/marge/job.py +++ b/marge/job.py @@ -343,7 +343,7 @@ def update_from_target_branch_and_push( # and likely explains any previous failure, so it will better to just # raise a GitError if source_branch != 'master': - repo.checkout_branch('master') + repo.checkout_branch('HEAD^') repo.remove_branch(source_branch) if not branch_update_done: