tools/fetch-distro: only fetch the configured branch

We don't need the other branches. This mostly cuts down on the
noise in output. But add '-v' to show what we're fetching.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2024-07-03 16:10:49 +02:00
parent 82c459f910
commit 8e84e15445

View File

@ -76,13 +76,14 @@ def checkout_distro(args, distro: str, config: dict):
args.fetch = False # no need to fetch if we just cloned
def update_distro(args, distro: str, config: dict):
cmd = ['git', '-C', f'pkg/{distro}', 'fetch']
print(f"+ {shlex.join(cmd)}")
subprocess.check_call(cmd)
branch = config['Environment']['GIT_BRANCH']
old_commit = config['Environment']['GIT_COMMIT']
cmd = ['git', '-C', f'pkg/{distro}', 'fetch', 'origin', '-v',
f'{branch}:remotes/origin/{branch}']
print(f"+ {shlex.join(cmd)}")
subprocess.check_call(cmd)
cmd = ['git', '-C', f'pkg/{distro}', 'rev-parse', f'refs/remotes/origin/{branch}']
print(f"+ {shlex.join(cmd)}")
new_commit = subprocess.check_output(cmd, text=True).strip()