From 01d10faba45c1cd1a69bff062d43aa1fa82562bd Mon Sep 17 00:00:00 2001
From: Tim Jaacks <tim.jaacks@garz-fricke.com>
Date: Tue, 29 Jun 2021 19:33:46 +0200
Subject: [PATCH] update_submodule: fix accidental multi-commits

If integration branch already existed and had to be replaced, the new
commit was accidentally pushed on top of the already existing commit
instead of replacing it. Fixed this by checking out the master branch
again before creating the commit.
---
 update_submodule.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/update_submodule.py b/update_submodule.py
index 091fec94..76aa3c89 100755
--- a/update_submodule.py
+++ b/update_submodule.py
@@ -107,6 +107,8 @@ def update_submodule(project, submodule_name, submodule_revision, branch=None):
                 return (integration_branch, existing_branch.commit, submodule_project)
             else:
                 print("Replacing outdated integration branch %s" % integration_branch)
+                repo.head.reference = branch
+                submodule = common.get_submodule(repo, submodule_name)
         else:
             print("Creating integration branch %s" % integration_branch)
 
-- 
GitLab