mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-21 04:10:37 +02:00
fix: index only mode setting doesn't work if it follows a full mode config
This commit is contained in:
parent
3e67622736
commit
489944a503
@ -25,7 +25,7 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import urllib
|
import urllib
|
||||||
from git import Optional
|
from typing import Optional
|
||||||
import yaml
|
import yaml
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
import logging
|
import logging
|
||||||
@ -687,11 +687,22 @@ def update_servergitmirrors(servergitmirrors, repo_section):
|
|||||||
progress = None
|
progress = None
|
||||||
|
|
||||||
repo = git.Repo.init(git_mirror_path, initial_branch=GIT_BRANCH)
|
repo = git.Repo.init(git_mirror_path, initial_branch=GIT_BRANCH)
|
||||||
initial_commit_ref = repo.head.commit
|
|
||||||
|
# An initial commit of the git tree is required be for other operations
|
||||||
|
initial_branch_ref = repo.head.ref
|
||||||
|
repo.index.commit('Initial commit')
|
||||||
|
|
||||||
enabled_remotes = []
|
enabled_remotes = []
|
||||||
for d in servergitmirrors:
|
for d in servergitmirrors:
|
||||||
index_only = d.get('index_only', False)
|
index_only = d.get('index_only', False)
|
||||||
|
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()
|
||||||
|
else:
|
||||||
|
repo.create_head('full', initial_branch_ref)
|
||||||
|
repo.heads.full.checkout()
|
||||||
|
|
||||||
remote_url = d['url']
|
remote_url = d['url']
|
||||||
name = REMOTE_HOSTNAME_REGEX.sub(r'\1', remote_url)
|
name = REMOTE_HOSTNAME_REGEX.sub(r'\1', remote_url)
|
||||||
enabled_remotes.append(name)
|
enabled_remotes.append(name)
|
||||||
@ -777,8 +788,9 @@ def update_servergitmirrors(servergitmirrors, repo_section):
|
|||||||
else:
|
else:
|
||||||
logging.debug(remote.url + ': ' + pushinfo.summary)
|
logging.debug(remote.url + ': ' + pushinfo.summary)
|
||||||
|
|
||||||
# Reset the repository to the initial commit so we can choose which files to commit to the next remote
|
# Switch to the initial branch
|
||||||
repo.head.reset(initial_commit_ref, index=True, working_tree=True)
|
repo.head.reference = initial_branch_ref
|
||||||
|
repo.head.reset(index=True, working_tree=True)
|
||||||
|
|
||||||
if progress:
|
if progress:
|
||||||
progressbar.done()
|
progressbar.done()
|
||||||
|
Loading…
Reference in New Issue
Block a user