packages: clone_pkgbuilds(): use git remote update before git switch

This commit is contained in:
InsanePrawn 2022-09-22 05:14:47 +02:00
parent 56dbd3966c
commit f395ef231b

View file

@ -33,9 +33,12 @@ def clone_pkgbuilds(pkgbuilds_dir: str, repo_url: str, branch: str, interactive=
if current_branch != branch:
logging.warning(f'pkgbuilds repository is on the wrong branch: {current_branch}, requested: {branch}')
if interactive and click.confirm('Would you like to switch branches?', default=False):
result = git(['remote', 'update'], dir=pkgbuilds_dir)
if result.returncode != 0:
raise Exception('failed updating PKGBUILDs branches')
result = git(['switch', branch], dir=pkgbuilds_dir)
if result.returncode != 0:
raise Exception('failed switching branches')
raise Exception('failed switching PKGBUILDs branches')
if update:
if interactive:
if not click.confirm('Would you like to try updating the PKGBUILDs repo?'):