packer.nvim icon indicating copy to clipboard operation
packer.nvim copied to clipboard

Setting a plugin's branch explicitly cause :PackerSync to "unshallow" the plugin

Open oblitum opened this issue 3 years ago • 6 comments

A shallow clone happens on initial install only (initial :PackerSync). Later :PackerSyncs cause unshallow of repos, pulling them a second time, it's rather annoying and can bloat the disk with unnecessary commit history.

oblitum avatar Jan 21 '22 21:01 oblitum

We run the fetch command, which has a non-shallow depth specified by default, when a branch, tag, or commit has been set. Perhaps we can be smarter about only running this if we don't already have a reference to the required branch?

wbthomason avatar Feb 06 '22 02:02 wbthomason

@wbthomason I don't know the codebase, so in thesis that seems ok to me.

oblitum avatar Feb 10 '22 11:02 oblitum

Hi @wbthomason! I would ask how is everything going here. Maybe for updating a plugin that we chose a particular branch we can just pull that branch, instead of fetching all the repo. I think would be quite interesting. For example, coc.nvim goes from 7.9MB to 58MB after unshallowing. It's quite a lot!

carlosala avatar Aug 12 '22 22:08 carlosala

On a related note, if we knew a commit's date we could take advantage of the --shallow-since option for clone, fetch and pull. This is part of my feature proposal for integrating a lockfile into packer #1009.

EdenEast avatar Aug 12 '22 23:08 EdenEast

Maybe we could check how vim-plug does this. I think when I was using it the clones were shallowed.

carlosala avatar Aug 13 '22 07:08 carlosala

Chiming in because I was looking into this myself. You can see Plug's behaviour wrt to shallow cloning in the test suite test/workflow.vader#L1536 Shallow clone is the default unless you disable it globally with g:plug_shallow = 0, or if the user specifies a tag for the Plugin (but not a branch). Finally shallow clone is disabled for non SSL repo's (anything over http not https).

justinhj avatar Aug 21 '22 18:08 justinhj