fix(deploy): Reference at 'refs/heads/full' does already exist

This commit is contained in:
proletarius101 2024-04-06 16:10:00 +08:00
parent d2ada6e418
commit 5e0980b98a
No known key found for this signature in database
1 changed files with 7 additions and 5 deletions

View File

@ -511,13 +511,15 @@ def update_servergitmirrors(servergitmirrors, repo_section):
enabled_remotes = []
for d in servergitmirrors:
index_only = d.get('index_only', False)
# Use a separate branch for the index only mode as it needs a different set of files to commit
if index_only:
# Use a separate branch for the index only mode as it needs a different set of files to commit
repo.create_head('index_only', initial_branch_ref)
repo.heads.index_only.checkout()
branch_name = 'index_only'
else:
repo.create_head('full', initial_branch_ref)
repo.heads.full.checkout()
branch_name = 'full'
if not branch_name in repo.heads:
repo.create_head(branch_name, initial_branch_ref)
repo.heads[branch_name].checkout()
remote_url = d['url']
name = REMOTE_HOSTNAME_REGEX.sub(r'\1', remote_url)