From cedc7c1d87b474d4ab45949ed7f5a28583dcfc10 Mon Sep 17 00:00:00 2001
From: Tim Jaacks <tim.jaacks@garz-fricke.com>
Date: Wed, 10 Aug 2022 09:05:51 +0200
Subject: [PATCH] commit_and_push: do not pass branch

Branch can be implicitly determined via the repo.
---
 scripts/common.py                  | 3 ++-
 scripts/deploy_gitlab_ci.py        | 1 -
 scripts/integrate_into_manifest.py | 1 -
 scripts/update_submodule.py        | 1 -
 4 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/scripts/common.py b/scripts/common.py
index 3f4d2bbe..26f6af0a 100755
--- a/scripts/common.py
+++ b/scripts/common.py
@@ -158,9 +158,10 @@ def list_commits(commits):
 
 
 def commit_and_push(
-    project: Project, repo: Repo, branch, message, name, email, less_verbose=False
+    project: Project, repo: Repo, message, name, email, less_verbose=False
 ):
     """Commit and push to a repo branch"""
+    branch = repo.head.reference
     author = Actor(name, email)
     repo.index.commit(message, author=author, committer=author)
     print(repo.git.log("--oneline", "-n", "5"))
diff --git a/scripts/deploy_gitlab_ci.py b/scripts/deploy_gitlab_ci.py
index 88839d30..a24b45ae 100755
--- a/scripts/deploy_gitlab_ci.py
+++ b/scripts/deploy_gitlab_ci.py
@@ -347,7 +347,6 @@ def main():
     integration_commit = common.commit_and_push(
         manifest_project["project"],
         manifest_project["repo"],
-        manifest_project["branch"],
         manifest_project["message"],
         gitlab.user.username,
         gitlab.user.email,
diff --git a/scripts/integrate_into_manifest.py b/scripts/integrate_into_manifest.py
index 8c0fd7d2..f943991b 100755
--- a/scripts/integrate_into_manifest.py
+++ b/scripts/integrate_into_manifest.py
@@ -178,7 +178,6 @@ def integrate_into_manifest(
         manifest_revision = common.commit_and_push(
             manifest_project,
             manifest_repo,
-            integration_branch,
             message,
             gitlab.user.username,
             gitlab.user.email,
diff --git a/scripts/update_submodule.py b/scripts/update_submodule.py
index 32bfe97d..d5f6b123 100755
--- a/scripts/update_submodule.py
+++ b/scripts/update_submodule.py
@@ -383,7 +383,6 @@ def update_submodule_and_include_ref(
             integration_commit = common.commit_and_push(
                 project,
                 project_repo,
-                integration_branch_name,
                 message,
                 gitlab.user.username,
                 gitlab.user.email,
-- 
GitLab