From c56f7a311fceec855ff86b9b7f6f59b1ff1409b3 Mon Sep 17 00:00:00 2001 From: James Frost Date: Fri, 4 Sep 2026 15:35:47 +0100 Subject: [PATCH] Add `--no-checkout` option to localmirror git clone This avoids checking out the files twice if we don't want the default branch, giving a small speedup. --- github_scripts/get_git_sources.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/github_scripts/get_git_sources.py b/github_scripts/get_git_sources.py index 883fd635..e61bb9d2 100644 --- a/github_scripts/get_git_sources.py +++ b/github_scripts/get_git_sources.py @@ -324,10 +324,7 @@ def clone_repo_mirror( # Clone if the repo doesn't exist. If the mirror is local we don't copy # the objects to make it much faster. try: - # Adding `--revision {fetch}` to the clone would be more efficient - # due to avoiding an unnecessary checkout, however we need to - # support versions of git older than v2.49. - run_command(f"git clone --shared {mirror_loc} {loc}") + run_command(f"git clone --shared --no-checkout {mirror_loc} {loc}") run_command(f"git -C {loc} checkout {fetch}") except SubprocessRunError: logger.error(