From e7f16131598ff99557c72aefb3399aff7c22b3a6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 16 Mar 2026 21:26:22 -1000 Subject: [PATCH] Use shallow clone (depth 1) for codspeed-cpp --- script/setup_codspeed_lib.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/script/setup_codspeed_lib.py b/script/setup_codspeed_lib.py index b827610102..b590587268 100755 --- a/script/setup_codspeed_lib.py +++ b/script/setup_codspeed_lib.py @@ -56,27 +56,27 @@ def _git(args: list[str], **kwargs: object) -> None: def _clone_repo(output_dir: Path) -> None: - """Clone codspeed-cpp at the pinned SHA with submodules.""" + """Shallow-clone codspeed-cpp at the pinned SHA with submodules.""" + output_dir.mkdir(parents=True, exist_ok=True) + _git(["init", str(output_dir)]) + _git(["-C", str(output_dir), "remote", "add", "origin", CODSPEED_CPP_REPO]) + _git(["-C", str(output_dir), "fetch", "--depth", "1", "origin", CODSPEED_CPP_SHA]) _git( - [ - "clone", - "--recurse-submodules", - "--shallow-submodules", - CODSPEED_CPP_REPO, - str(output_dir), - ] + ["-C", str(output_dir), "checkout", "FETCH_HEAD"], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, ) _git( [ "-C", str(output_dir), - "-c", - "advice.detachedHead=false", - "checkout", - CODSPEED_CPP_SHA, - ], - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, + "submodule", + "update", + "--init", + "--recursive", + "--depth", + "1", + ] )