deploy: use master branch when working complete git-mirror repo

The *-nightly git repo always uses the _master_ branch.  The `index_only:`
support maintains a separate local branch since its git repo should be as
small as possible.  The full repo should be maintained for mirrors not
using `index_only:` so that when it force-pushes, it does not need to always
push all the files, only the updated ones.  So the full repo should be
maintained in the _master_ branch, and only the `index_only` mirrors should
have their own branch.

This adds a test case to reproduce this error:
https://gitlab.com/fdroid/fdroidclient/-/jobs/10347168516

This case also applies to any setup that used `servergitmirrors:` before the
`index_only:` feature was added.  This also applies to cases if the repo
maintainer manually clones the *-nightly repo into _fdroid/git-mirror/_
This commit is contained in:
Hans-Christoph Steiner 2025-06-18 19:06:27 +02:00 committed by Torsten Grote
parent 51c973f15e
commit 53bf6c7ce1

View File

@ -617,6 +617,13 @@ def update_servergitmirrors(servergitmirrors, repo_section):
For history, there is the archive section, and there is the binary For history, there is the archive section, and there is the binary
transparency log. transparency log.
This will attempt to use the existing remote branch so that it does
not have to push all of the files in the repo each time. Old setups
or runs of `fdroid nightly` might use the "master" branch. For the
"index only" mode, it will recreate the branch from scratch each
time since usually all the files are changed. In any case, the
index files are small compared to the full repo.
""" """
from clint.textui import progress from clint.textui import progress
@ -687,7 +694,7 @@ def update_servergitmirrors(servergitmirrors, repo_section):
if is_index_only: if is_index_only:
local_branch_name = 'index_only' local_branch_name = 'index_only'
else: else:
local_branch_name = 'full' local_branch_name = GIT_BRANCH
if local_branch_name in repo.heads: if local_branch_name in repo.heads:
repo.git.switch(local_branch_name) repo.git.switch(local_branch_name)
else: else: