From 243a0475f956db7624469302ccfb2d5e04b5fbe1 Mon Sep 17 00:00:00 2001 From: linsui <2873532-linsui@users.noreply.gitlab.com> Date: Thu, 10 Apr 2025 14:48:08 +0800 Subject: [PATCH] checkupdates: don't create branch with .lock end --- fdroidserver/checkupdates.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index b4a6e631..9ed93298 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -769,6 +769,10 @@ def push_commits(branch_name='checkupdates'): * https://docs.gitlab.com/ee/user/project/push_options.html """ + if branch_name != "checkupdates": + if callable(getattr(git.SymbolicReference, "_check_ref_name_valid", None)): + git.SymbolicReference._check_ref_name_valid(branch_name) + git_repo = git.Repo.init('.') upstream_main = get_upstream_main_branch(git_repo) files = set() @@ -783,6 +787,10 @@ def push_commits(branch_name='checkupdates'): if not files: return + # https://git-scm.com/docs/git-check-ref-format Git refname can't end with .lock + if branch_name.endswith(".lock"): + branch_name = f"{branch_name}_" + remote = git_repo.remotes.origin if branch_name in remote.refs: if not get_changes_versus_ref(git_repo, f'origin/{branch_name}', files[0]):