Skip to content

Commit

Permalink
perf: faster blobless git clones
Browse files Browse the repository at this point in the history
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: pypa/pip#9086.

@moduon MT-83
  • Loading branch information
yajo committed Feb 11, 2022
1 parent cb1277a commit 0d74bdd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion poetry/core/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,14 @@ def config(self): # type: () -> GitConfig
def clone(self, repository, dest): # type: (str, 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, folder=None): # type: (str, Optional[Path]) -> str
args = []
Expand Down

0 comments on commit 0d74bdd

Please sign in to comment.