fix(git): configure push remote for auto branches

This commit is contained in:
hermes
2026-09-20 17:44:33 +00:00
parent 41dc2f8485
commit 01465fa1c5
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ state = SharedStateHolderInMemory(unmerge=unmerge)
checkoutMerged = CheckoutMerged(
clone,
desired_branches=state,
push=True,
push="gitea_hermes",
git_user_email="rudolfss13@gmail.com",
git_user_name="brencher_bot",
)
+3 -2
View File
@@ -189,7 +189,7 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]):
desired_branches: AbstractStep[SharedState],
git_user_email: str,
git_user_name: str,
push: bool = True,
push: bool | str = True,
**kwargs: Any):
super().__init__(**kwargs)
self.wd = wd
@@ -315,9 +315,10 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]):
if self.push:
auto_branch_hash = hashlib.sha1(''.join([x.hexsha for x in sorted_commits]).encode()).hexdigest()
auto_branch_name = f"auto-{version}"
push_remote = self.push if isinstance(self.push, str) else "origin"
logger.info(f"Pushing {repo.head.commit.hexsha} -> {auto_branch_name}")
repo.git.push('-f', 'origin', f"HEAD:refs/heads/{auto_branch_name}")
repo.git.push('-f', push_remote, f"HEAD:refs/heads/{auto_branch_name}")
remote_branch_name = auto_branch_name
return CheckoutAndMergeResult(