ci: handle changing wrap file refs
authorMatthew Waters <matthew@centricular.com>
Mon, 4 Nov 2024 04:52:11 +0000 (15:52 +1100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 5 Nov 2024 10:21:44 +0000 (10:21 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7809>

ci/scripts/handle-subprojects-cache.py

index 5ad47c89f97e68cbbe51c795301e8bbbb8a254cb..c97c4a3fab0c3c9f437b1ab0353e18f5f5235484 100755 (executable)
@@ -68,6 +68,15 @@ def copy_cache(options):
 
             print("Copying from %s -> %s" % (cache_dir, project_path))
             shutil.copytree(cache_dir, project_path)
+
+            # workaround `meson subprojects download` only providing a shallow
+            # clone.
+            # If we need to change refs, then the git repo will only ever be
+            # able to reference the originally cloned ref.
+            git_path = os.path.join(project_path, '.git')
+            if os.path.exists(git_path):
+                subprocess.check_call(['git', '-C', git_path, 'remote', 'set-branches', 'origin', '*'])
+
     subprocess.check_call(['meson', 'subprojects', 'update', '--reset'])