tools/fetch-distro: only fetch the configured branch
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 3 Jul 2024 14:10:49 +0000 (16:10 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 24 Jul 2024 12:26:49 +0000 (14:26 +0200)
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.

(cherry picked from commit 8e84e154457b0d55e823f670c377233b0211d2b7)

tools/fetch-distro.py

index dacaf28bcaf8cfb6cdc951e78a8c51f6d4ac5248..e7f9f59104eb648389475dd44478870881e23ebb 100755 (executable)
@@ -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()