]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fetch-distro: Fetch before we switch branches
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 21 Mar 2025 20:34:12 +0000 (21:34 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 21 Mar 2025 21:21:37 +0000 (21:21 +0000)
Otherwise the branch we're switching to might not exist yet.

tools/fetch-distro.py

index 6d1c35ba6bf5e98020c5c1dba0565aab49c4f45c..b91833a68f0cd96b241ca1158d1e1df93074674a 100755 (executable)
@@ -97,16 +97,16 @@ def update_distro(args, distro: str, config: dict):
     subdir = config['Environment'].get('GIT_SUBDIR')
     old_commit = config['Environment']['GIT_COMMIT']
 
-    cmd = ['git', '-C', f'pkg/{distro}', 'switch', branch]
-    print(f"+ {shlex.join(cmd)}")
-    subprocess.check_call(cmd)
-
     if args.fetch:
         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}', 'switch', branch]
+    print(f"+ {shlex.join(cmd)}")
+    subprocess.check_call(cmd)
+
     cmd = ['git', '-C', f'pkg/{distro}', 'log', '-n1', '--format=%H',
            f'refs/remotes/origin/{branch}']
     if subdir is not None: