Closed jerryc05 closed 2 years ago
Hi,
I am not sure hot to pass the ice modifier to [sh -c "$(curl -fsSL https://git.io/zinit-install)"] when installing zinit (not installing zinit plugins).
BTW, I am not sure if zinit update (both self and plugins) is respecting the ice modifier because I saw a long list of git logs when updating, which might not happen if we are git-fetching using depth=1
Salvydas Lukosius @.***> 于2021年12月15日周三 11:33写道:
Did you mean zinit-install.zsh? If so this feature exists as Ice modifier. Which looks like this:
zinit ice
'' ... Modifier Description proto Change protocol to git,ftp,ftps,ssh, rsync, etc. Default is https. Does not work with snippets. from https://github.com/z-shell/zi/wiki/Private-Repositories/ Clone plugin from given site. Supported are from"github" (default), ..."github-rel", ..."gitlab", ..."bitbucket", ..."notabug" (short names: gh, gh-r, gl, bb, nb). Can also be a full domain name (e.g. for GitHub enterprise). Does not work with snippets. ver Used with from"gh-r" (i.e. downloading a binary release, e.g. for use with as"program") – selects which version to download. Default is latest, can also be explicitly ver"latest". Works also with regular plugins, checkouts e.g. ver"abranch", i.e. a specific version. Does not work with snippets. bpick Used to select which release from GitHub Releases to download, e.g. zini ice from"gh-r" as"program" bpick"Darwin"; zini load docker/compose. Does not work with snippets. depth Pass --depth to git, i.e. limit how much of history to download. Does not work with snippets. cloneopts Pass the contents of cloneopts to git clone. Defaults to --recursive. I.e.: change cloning options. Pass empty ice to disable recursive cloning. Does not work with snippets. pullopts Pass the contents of pullopts to git pull used when updating plugins. Does not work with snippets. svn Use Subversion for downloading snippet. GitHub supports SVN protocol, this allows to clone subdirectories as snippets, e.g. zi ice svn; zi snippet OMZP::git. Other ice pick can be used to select file to source (default are: .plugin.zsh, init.zsh, .zsh-theme). Does not work with plugins. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zdharma-continuum/zinit/issues/138#issuecomment-994959842, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7LTMSZEFLJYZQP7UZPUUTURC7OBANCNFSM5J67B6JA .
--
Ziyan "Jerry" Chen @.***> Undergrad student of U of Mich & U of MD.
Hey @jerryc05, :wave:
My mistake :octocat:. It seems to be the following line: https://github.com/zdharma-continuum/zinit/blob/9ee45d6804fdf4972a9e913a1ad86d77de124231/scripts/install.sh#L220
Yes that is the line I am talking about.
So can we make shallow-clone the default option?
Ran using hyperfine
hyperfine --prepare="rm -rf zinit" --runs=100 "$COMMAND" --export-markdown=single-branch-clone.md
and
git-sizer
COMMAND | Mean [s] | Min [s] | Max [s] | Relative |
---|---|---|---|---|
git clone https://github.com/zdharma-continuum/zinit |
3.921 ± 1.226 | 1.933 | 7.661 | 1.00 |
Processing blobs: 8684 Processing trees: 9808 Processing commits: 4081 Matching commits to trees: 4081 Processing annotated tags: 36 Processing references: 95 | Name | Value | Level of concern |
---|---|---|---|
Overall repository size | |||
* Commits | |||
* Count | 4.08 k | ||
* Total size | 1.48 MiB | ||
* Trees | |||
* Count | 9.81 k | ||
* Total size | 4.21 MiB | ||
* Total tree entries | 115 k | ||
* Blobs | |||
* Count | 8.68 k | ||
* Total size | 478 MiB | ||
* Annotated tags | |||
* Count | 36 | ||
* References | |||
* Count | 95 | ||
* Branches | 1 | ||
* Tags | 36 | ||
* Remote-tracking refs | 58 | ||
Biggest objects | |||
* Commits | |||
* Maximum size [1] | 8.52 KiB | ||
* Maximum parents [2] | 2 | ||
* Trees | |||
* Maximum entries [3] | 104 | ||
* Blobs | |||
* Maximum size [4] | 662 KiB | ||
History structure | |||
* Maximum history depth | 3.40 k | ||
* Maximum tag depth [5] | 1 | ||
Biggest checkouts | |||
* Number of directories [6] | 541 | ||
* Maximum path depth [7] | 11 | * | |
* Maximum path length [8] | 147 B | * | |
* Number of files [6] | 2.24 k | ||
* Total size of files [9] | 21.7 MiB | ||
* Number of symlinks [10] | 148 | ||
* Number of submodules [11] | 1 |
[1] 137e70a25583d73e7b4050d0bc67074609d776ef [2] 9ee45d6804fdf4972a9e913a1ad86d77de124231 (refs/heads/main) [3] d53ea7b458dfb1b6cde01e5506164bd9c7059f62 (7354f2a085fbd2d8cd8e1792d12836b0e37c558b:test/models) [4] 146f4b44bca114cc82b67515daec3287949fdbd1 (refs/remotes/origin/gh-pages:wiki/assets/javascripts/lunr/wordcut.js) [5] c2f9409f11a1c928adc4e2262c2e17858e4752ed (refs/tags/abs-paths) [6] 6128cc0c4bdc9e70a6ab4004fe6322921f5dc4bd (260a58ae6d0845a7e14c9c7ce9ca7233205435be^{tree}) [7] 4e78f1e78a6443b4bf197b2d3ba8c678ea369294 (d1b8bd3cfb1ecf03eb8ae23b717588d7ee63c564^{tree}) [8] 8b182ebd457dc66f745468913d270165d9b68313 (e727ec50cce89a9d1bf116930986d5cb75c439bf^{tree}) [9] 47159097898f3328e90ca681d12b88a473da85e6 (7087864542fcd4bcf18067f828c6db8594a05480^{tree}) [10] 1ea1fc8b041330035c1af9bf87b000cd2c87c64e (refs/remotes/origin/tests^{tree}) [11] 67f260849d6ecb8d418d86cc1c0770af36d0e7a2 (e39e8477b31a01d3e028de8f7e7927a251a05d3b:test/_test3/model/plugins)
COMMAND | Mean [s] | Min [s] | Max [s] | Relative |
---|---|---|---|---|
git clone --single-branch https://github.com/zdharma-continuum/zinit |
2.062 ± 0.651 | 1.358 | 5.146 | 1.00 |
Processing blobs: 5052 Processing trees: 5277 Processing commits: 3517 Matching commits to trees: 3517 Processing annotated tags: 36 Processing references: 39 | Name | Value | Level of concern |
---|---|---|---|
Overall repository size | |||
* Commits | |||
* Count | 3.52 k | ||
* Total size | 1.24 MiB | ||
* Trees | |||
* Count | 5.28 k | ||
* Total size | 2.78 MiB | ||
* Total tree entries | 76.4 k | ||
* Blobs | |||
* Count | 5.05 k | ||
* Total size | 254 MiB | ||
* Annotated tags | |||
* Count | 36 | ||
* References | |||
* Count | 39 | ||
* Branches | 1 | ||
* Tags | 36 | ||
* Remote-tracking refs | 2 | ||
Biggest objects | |||
* Commits | |||
* Maximum size [1] | 8.52 KiB | ||
* Maximum parents [2] | 2 | ||
* Trees | |||
* Maximum entries [3] | 104 | ||
* Blobs | |||
* Maximum size [4] | 389 KiB | ||
History structure | |||
* Maximum history depth | 3.40 k | ||
* Maximum tag depth [5] | 1 | ||
Biggest checkouts | |||
* Number of directories [6] | 506 | ||
* Maximum path depth [7] | 11 | * | |
* Maximum path length [6] | 147 B | * | |
* Number of files [6] | 1.57 k | ||
* Total size of files [6] | 6.15 MiB | ||
* Number of symlinks [8] | 110 | ||
* Number of submodules [9] | 1 |
[1] 137e70a25583d73e7b4050d0bc67074609d776ef [2] 9ee45d6804fdf4972a9e913a1ad86d77de124231 (refs/heads/main) [3] d53ea7b458dfb1b6cde01e5506164bd9c7059f62 (7354f2a085fbd2d8cd8e1792d12836b0e37c558b:test/models) [4] 6f019100f498b21de325aaff0a0d9bffb8b3bfe4 (f2796a23378869b69709bec9f79a57cdca3e4df9:zmodules/configure) [5] c2f9409f11a1c928adc4e2262c2e17858e4752ed (refs/tags/abs-paths) [6] 8b182ebd457dc66f745468913d270165d9b68313 (e727ec50cce89a9d1bf116930986d5cb75c439bf^{tree}) [7] 4e78f1e78a6443b4bf197b2d3ba8c678ea369294 (d1b8bd3cfb1ecf03eb8ae23b717588d7ee63c564^{tree}) [8] 5fbc160e4f2b91eddaa64638b3f2f6b8fd3d97ec (e727ec50cce89a9d1bf116930986d5cb75c439bf:test) [9] 67f260849d6ecb8d418d86cc1c0770af36d0e7a2 (e39e8477b31a01d3e028de8f7e7927a251a05d3b:test/_test3/model/plugins)
Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
---|---|---|---|---|
git clone --depth=1 https://github.com/zdharma-continuum/zinit |
991.2 ± 185.0 | 796.3 | 1899.5 | 1.00 |
Unable to get in-depth size details due to cloning w/ --depth=1
.
Cuts about 2s off the clone time. Most people will never venture off main
. This change seems fine to me.
Installing zinit itself by shallow cloning is fine I guess, I'm not sure if shallow cloning by default for plugins is a good idea though.
How does a git shallow cloned repo behave when a plugin author decides to force-push to the tracked branch and we then pull?
Also there's an ice for that already, and there's the default ice annex as well.
I was under the impression we were just talking about zinit
installation, not plugins.
Due to the size and nature of Zinit, the benefit(s) of switching to partial/shallow clones would not be worth it.
For more information, see this GitHub article.
Feature request
Not sure if this is already implemented
Can you make
zsh-install
script usegit clone --single-branch -b main --depth 1
by default, or have an option to do so?EDIT: and also use git's shallow-fetch-and-reset to achieve minimum bandwidth usage
EDIT 2: I mean to use git fetch with respect to zinit
ice
modifiers when updating either zinit itself or zinit plugins. For more info pls refer to this link.