From 23ae397ae0cf2d348e1dba3fd23fa0ea4e593f60 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 11 Feb 2022 10:24:41 +0000 Subject: [PATCH] perf: faster blobless git clones Cloning a repo with git can be really slow if the repo is big. Adding `--filter=blob:none` to the `git clone` command will make it really faster and slimmer because it will lazy-download blobs on checkout, while only getting commit metadata for whatever is not checked out. See "Blobless Clones" in https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ for a good explanation. Also interesting to see that pip 21.3 itself landed this enhancement: https://github.com/pypa/pip/pull/9086. @moduon MT-83 --- src/poetry/core/vcs/git.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/poetry/core/vcs/git.py b/src/poetry/core/vcs/git.py index 2fc6fceaf..5a24361e3 100644 --- a/src/poetry/core/vcs/git.py +++ b/src/poetry/core/vcs/git.py @@ -259,7 +259,14 @@ def config(self) -> GitConfig: def clone(self, repository: str, dest: Path) -> str: self._check_parameter(repository) - return self.run("clone", "--recurse-submodules", "--", repository, str(dest)) + return self.run( + "clone", + "--filter=blob:none", + "--recurse-submodules", + "--", + repository, + str(dest), + ) def checkout(self, rev: str, folder: Optional[Path] = None) -> str: args = []