mirror of
https://github.com/zdharma-continuum/zinit.git
synced 2026-09-10 15:46:36 -04:00
Compare commits
10 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1eae28dfb5 | ||
|
|
db9e267184 | ||
|
|
ce9bdf9990 | ||
|
|
b8855c7887 | ||
|
|
98bcb79c3d | ||
|
|
a8bc3d0cf6 | ||
|
|
fdcbb25688 | ||
|
|
8197f3215b | ||
|
|
a85e9dcc3e | ||
|
|
cc3baf395f |
7
.github/workflows/tests.yaml
vendored
7
.github/workflows/tests.yaml
vendored
|
|
@ -57,7 +57,7 @@ jobs:
|
|||
|
||||
- name: "install homebrew"
|
||||
id: setup-homebrew
|
||||
uses: Homebrew/actions/setup-homebrew@a657b8b0cd35d0f65cce41fce9b24cf054b49869
|
||||
uses: Homebrew/actions/setup-homebrew@f8d4222eb633e65c2a0157383cf80861fc7fae7f
|
||||
|
||||
- name: "install ${{ runner.os }} dependencies"
|
||||
if: runner.os == 'Linux'
|
||||
|
|
@ -73,12 +73,13 @@ jobs:
|
|||
ninja-build \
|
||||
pkg-config \
|
||||
xz-utils \
|
||||
zsh
|
||||
zsh \
|
||||
zstd
|
||||
|
||||
- name: "install dependencies via brew"
|
||||
id: install-deps
|
||||
run: |
|
||||
brew install --quiet --force --overwrite autoconf automake binutils byacc coreutils curl gettext gnu-sed jemalloc libevent libtool libuv lua lua@5.4 make ninja parallel pkg-config texinfo unzip xz zsh
|
||||
brew install --quiet --force --overwrite autoconf automake binutils byacc coreutils curl gettext gnu-sed jemalloc libevent libtool libuv lua lua@5.4 make ninja parallel pkg-config texinfo unzip xz zsh zstd
|
||||
brew unlink ncurses && brew link --force ncurses
|
||||
|
||||
- name: "checkout zdharma-continuum/zunit"
|
||||
|
|
|
|||
19
CHANGELOG.md
19
CHANGELOG.md
|
|
@ -1,3 +1,22 @@
|
|||
# [3.17.0](https://github.com/zdharma-continuum/zinit/compare/v3.16.0...v3.17.0) (2026-09-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **ziextract:** support zst archive format ([b8855c7](https://github.com/zdharma-continuum/zinit/commit/b8855c7887e26f79934b6122232b141cdd3106bf))
|
||||
|
||||
# [3.16.0](https://github.com/zdharma-continuum/zinit/compare/v3.15.3...v3.16.0) (2026-08-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **self-update:** honor -q in changelog display ([a85e9dc](https://github.com/zdharma-continuum/zinit/commit/a85e9dcc3ee2beebf3947ef6091ccd540d94f6f3))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **self-update:** support -n/--no-pager ([cc3baf3](https://github.com/zdharma-continuum/zinit/commit/cc3baf395fa51de11e7d76b11104e36d8d142601)), closes [#632](https://github.com/zdharma-continuum/zinit/issues/632)
|
||||
|
||||
## [3.15.3](https://github.com/zdharma-continuum/zinit/compare/v3.15.2...v3.15.3) (2026-08-28)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -228,6 +228,9 @@ ### Upgrade Zinit and plugins<a name="upgrade-zinit-and-plugins"></a>
|
|||
# Self update
|
||||
zinit self-update
|
||||
|
||||
# Self update, without paging the changelog
|
||||
zinit self-update --no-pager
|
||||
|
||||
# Plugin update
|
||||
zinit update
|
||||
|
||||
|
|
@ -909,7 +912,7 @@ ### Other<a name="other"></a>
|
|||
| Command | Description |
|
||||
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `module` | Manage binary Zsh module shipped with Zinit, see `zinit module help`. |
|
||||
| `self-update` | Updates and compiles Zinit. |
|
||||
| `self-update [-q] [-n]` | Updates and compiles Zinit.<br> `-q` \| `--quiet` – turn off messages from the operation.<br> `-n` \| `--no-pager` – disable the use of the pager for the changelog. |
|
||||
| `cd {plg-spec}` | Cd into plugin's directory. Also support snippets if fed with URL. |
|
||||
| `edit {plg-spec}` | Edit plugin's file with $EDITOR. |
|
||||
| `changes {plg-spec}` | View plugin's git log. |
|
||||
|
|
@ -927,7 +930,7 @@ ### Other<a name="other"></a>
|
|||
|
||||
## Updating Zinit and Plugins<a name="updating-zinit-and-plugins"></a>
|
||||
|
||||
To update Zinit issue `zinit self-update` in the command line.
|
||||
To update Zinit issue `zinit self-update` in the command line. The changelog is shown in a pager – pass `-n`/`--no-pager` to print it to the terminal instead, or `-q`/`--quiet` to skip it.
|
||||
|
||||
To update all plugins and snippets, issue `zinit update`. If you wish to update only a single plugin/snippet instead
|
||||
issue `zinit update NAME_OF_PLUGIN`. A list of commits will be shown:
|
||||
|
|
|
|||
1
_zinit
1
_zinit
|
|
@ -275,6 +275,7 @@ _zinit_run(){
|
|||
_zinit_self_update(){
|
||||
_arguments -A \
|
||||
'(-h --help)'{-h,--help}'[Show this help message]' \
|
||||
'(-n --no-pager)'{-n,--no-pager}'[Disable the use of the pager]' \
|
||||
'(-q --quiet)'{-q,--quiet}'[Turn off messages from the operation]' \
|
||||
&& ret=0
|
||||
} # ]]]
|
||||
|
|
|
|||
66
tests/_support/self_update_fixtures
Normal file
66
tests/_support/self_update_fixtures
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Fixtures for the `zinit self-update` pager regression tests (issue #632).
|
||||
#
|
||||
# make_self_update_behind_upstream leaves the sandbox clone exactly one
|
||||
# commit behind a scratch bare upstream. The fixture commit reuses HEAD's
|
||||
# tree, so the fast-forward pull done by `zinit self-update` moves only the
|
||||
# branch pointer: the unstaged diff the bootstrap applies stays intact and
|
||||
# no working-tree restore is needed, even when an assertion aborts the
|
||||
# test. Everything is offline and also works when the bootstrap clone is a
|
||||
# detached HEAD (CI pull_request checkouts), because the `main` branch and
|
||||
# its upstream are created here.
|
||||
|
||||
typeset -g SU_FIXTURE_SUBJECT='chore: self-update pager regression fixture'
|
||||
|
||||
make_self_update_behind_upstream() {
|
||||
local bin="${ZINIT[BIN_DIR]}" up="${ZINIT[HOME_DIR]}/self-update-upstream.git"
|
||||
local fixture_sha
|
||||
|
||||
# The bootstrap clone is depth=1. Complete it (origin is the local repo,
|
||||
# so this is offline) to lift the shallow-repo restrictions from the
|
||||
# local-path push below. From the second call on, the repo is already
|
||||
# complete and this fails harmlessly.
|
||||
command git -C "$bin" fetch --quiet --unshallow 2>/dev/null || true
|
||||
|
||||
# The sandbox tree is dirty (the bootstrap applies the unstaged diff), so
|
||||
# ambient pull.rebase/autostash settings change what `git pull` does and
|
||||
# prints: rebase mode refuses the dirty tree, autostash prints notices
|
||||
# even under --quiet. Pin all three off in the clone so the pull is a
|
||||
# silent fast-forward everywhere. --local keeps the writes inside the
|
||||
# sandbox even where GIT_CONFIG points elsewhere.
|
||||
command git -C "$bin" config --local pull.rebase false 2>/dev/null || true
|
||||
command git -C "$bin" config --local merge.autostash false 2>/dev/null || true
|
||||
command git -C "$bin" config --local rebase.autoStash false 2>/dev/null || true
|
||||
|
||||
fixture_sha=$(command git -C "$bin" -c user.name=zunit -c user.email=zunit@localhost \
|
||||
commit-tree 'HEAD^{tree}' -p HEAD -m "$SU_FIXTURE_SUBJECT") || true
|
||||
[[ -n $fixture_sha ]] || fail 'fixture: commit-tree failed'
|
||||
|
||||
command rm -rf -- "$up"
|
||||
command git -c init.defaultBranch=main init --quiet --bare "$up" 2>/dev/null \
|
||||
|| fail 'fixture: git init failed'
|
||||
command git -C "$bin" push --quiet "$up" "${fixture_sha}:refs/heads/main" \
|
||||
|| fail 'fixture: git push failed'
|
||||
|
||||
# remove+add also replaces the narrowed single-branch fetch refspec of
|
||||
# the depth=1 bootstrap clone with the wildcard one that the `git pull`
|
||||
# inside self-update relies on.
|
||||
command git -C "$bin" remote remove origin 2>/dev/null || true
|
||||
command git -C "$bin" remote add origin "$up" || fail 'fixture: remote add failed'
|
||||
command git -C "$bin" fetch --quiet origin || fail 'fixture: fetch failed'
|
||||
|
||||
# Covers detached-HEAD sandboxes and avoids the non-main-branch warning
|
||||
# that self-update prints even under --quiet.
|
||||
command git -C "$bin" checkout --quiet -B main || fail 'fixture: checkout failed'
|
||||
command git -C "$bin" branch --quiet --set-upstream-to=origin/main main \
|
||||
|| fail 'fixture: set-upstream failed'
|
||||
}
|
||||
|
||||
restore_self_update_origin() {
|
||||
local bin="${ZINIT[BIN_DIR]}"
|
||||
[[ -n $GIT_REPO ]] || return 0
|
||||
command git -C "$bin" remote remove origin 2>/dev/null || true
|
||||
command git -C "$bin" remote add origin "file://${GIT_REPO:A}" 2>/dev/null || true
|
||||
command rm -rf -- "${ZINIT[HOME_DIR]}/self-update-upstream.git"
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
@setup {
|
||||
typeset -gx HOME="$zi_test_dir"
|
||||
typeset -gx ZBIN="$zi_test_dir/polaris/bin"
|
||||
load "${PWD}/tests/_support/self_update_fixtures"
|
||||
}
|
||||
|
||||
@test 'help' {
|
||||
|
|
@ -77,6 +78,7 @@
|
|||
run zinit self-update $flag
|
||||
assert $output contains 'self-update'
|
||||
assert $output contains '--quiet'
|
||||
assert $output contains '--no-pager'
|
||||
assert $state equals 1
|
||||
done
|
||||
}
|
||||
|
|
@ -93,6 +95,41 @@
|
|||
assert $output contains '--foo'
|
||||
assert $state equals 1
|
||||
}
|
||||
@test 'self-update --no-pager / -n accepted when up to date' {
|
||||
for flag in '--no-pager' '-n'; do
|
||||
run zinit self-update $flag
|
||||
assert $output contains 'Already up to date'
|
||||
assert $state equals 0
|
||||
done
|
||||
}
|
||||
@test 'self-update pages the commit list through less by default' {
|
||||
less() { command cat > /dev/null; builtin print -- 'PAGER-INVOKED'; }
|
||||
make_self_update_behind_upstream
|
||||
run zinit self-update
|
||||
assert $output contains 'PAGER-INVOKED'
|
||||
assert $output does_not_contain $SU_FIXTURE_SUBJECT
|
||||
assert $state equals 0
|
||||
}
|
||||
@test 'self-update --no-pager / -n prints the commit list without the pager' {
|
||||
less() { command cat > /dev/null; builtin print -- 'PAGER-INVOKED'; }
|
||||
for flag in '--no-pager' '-n'; do
|
||||
make_self_update_behind_upstream
|
||||
run zinit self-update $flag
|
||||
assert $output contains $SU_FIXTURE_SUBJECT
|
||||
assert $output does_not_contain 'PAGER-INVOKED'
|
||||
assert $state equals 0
|
||||
done
|
||||
}
|
||||
@test 'self-update --quiet / -q skips the pager when behind upstream' {
|
||||
less() { command cat > /dev/null; builtin print -- 'PAGER-INVOKED'; }
|
||||
for flag in '--quiet' '-q'; do
|
||||
make_self_update_behind_upstream
|
||||
run zinit self-update $flag
|
||||
assert $output is_empty
|
||||
assert $state equals 0
|
||||
done
|
||||
restore_self_update_origin
|
||||
}
|
||||
@test 'set-debug' {
|
||||
ZINIT+=(DEBUG 'true')
|
||||
run +zi-log -n '{dbg} message'
|
||||
|
|
|
|||
|
|
@ -593,6 +593,18 @@
|
|||
local onefetch="$ZBIN/onefetch"; assert "$onefetch" is_executable
|
||||
run $onefetch --version; assert $state equals 0
|
||||
}
|
||||
@test 'ollama' { # Get up and running with large language models
|
||||
# The suite's only `.tar.zst' release asset. darwin ships a `.tgz', so the
|
||||
# zstd extraction path is reachable on Linux only. bpick drops the
|
||||
# accelerator builds (mlx/rocm/jetpack), which sort ahead of the plain one.
|
||||
[[ $OSTYPE =~ 'darwin*' ]] && skip "no .tar.zst asset on $os_type"
|
||||
(( ${+commands[zstd]} )) || skip 'zstd not installed'
|
||||
run zinit id-as lbin'!ollama' bpick'^*(mlx|rocm|jetpack)*' for @ollama/ollama; assert $state equals 0
|
||||
assert $output does_not_contain 'ERROR'
|
||||
assert $output does_not_contain "didn't recognize archive type"
|
||||
local ollama="$ZBIN/ollama"; assert "$ollama" is_executable
|
||||
run "$ollama" --version; assert $state equals 0
|
||||
}
|
||||
@test 'ouch' { # Painless compression and decompression for your terminal
|
||||
run zinit for @ouch-org/ouch; assert $state equals 0
|
||||
local ouch="$ZBIN/ouch"; assert "$ouch" is_executable
|
||||
|
|
|
|||
|
|
@ -2005,7 +2005,7 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
|
|||
builtin cd -q "$ZINIT[BIN_DIR]" \
|
||||
&& lines=( ${(f)"$(command git log --color --date=short --pretty=format:'%Cgreen%cd %h %Creset%s %Cred%d%Creset || %b' ..@\{u\})"} )
|
||||
# Use '..@{u}' which refers to the configured upstream branch, instead of '..origin/HEAD'
|
||||
if (( ${#lines} > 0 )); then
|
||||
if (( ${#lines} > 0 && ! OPTS[opt_-q,--quiet] )); then
|
||||
# Remove the (origin/main ...) segments, to expect only tags to appear
|
||||
lines=( "${(S)lines[@]//\(([,[:blank:]]#(origin|HEAD|master|main)[^a-zA-Z]##(HEAD|origin|master|main)[,[:blank:]]#)#\)/}" )
|
||||
# Remove " ||" if it ends the line (i.e. no additional text from the body)
|
||||
|
|
|
|||
|
|
@ -1496,7 +1496,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
|||
+zi-log "{e} {b}gh-r{rst}: {ice}bpick{rst} ice found no release assets To fix, modify the {ice}bpick{rst} glob pattern {glob}$bpick{rst}"
|
||||
fi
|
||||
else
|
||||
local junk='*((s(ha256|ig|um)|386|asc|md5|txt|vsix)*|(apk|b3|deb|json|pkg|rpm|sh|zst)(#e))';
|
||||
local junk='*((s(ha256|ig|um)|386|asc|md5|txt|vsix)*|(apk|b3|deb|json|pkg|rpm|sh)(#e))|*.pkg.tar.zst|(*.zst~*.tar.zst)';
|
||||
# print -l ${${(m@)list:#${~junk}}:t}
|
||||
filtered=( ${(m@)list:#(#i)${~junk}} ) && (( $#filtered > 0 )) && list=( ${filtered[@]} )
|
||||
fi
|
||||
|
|
@ -1553,7 +1553,7 @@ ziextract() {
|
|||
# First try known file extensions
|
||||
local -aU files
|
||||
integer ret_val
|
||||
files=( (#i)**/*.(zip|rar|7z|tgz|tbz|tbz2|tar.gz|tar.bz2|tar.7z|txz|tar.xz|gz|xz|tar|dmg|exe)~(*/*|.(_backup|git))/*(-.DN) )
|
||||
files=( (#i)**/*.(zip|rar|7z|tgz|tbz|tbz2|tar.gz|tar.bz2|tar.7z|txz|tar.xz|tar.zst|gz|xz|tar|dmg|exe)~(*/*|.(_backup|git))/*(-.DN) )
|
||||
for file ( $files ) {
|
||||
ziextract "$file" $opt_move $opt_move2 $opt_norm $opt_nobkp ${${${#files}:#1}:+--nobkp}
|
||||
ret_val+=$?
|
||||
|
|
@ -1664,6 +1664,9 @@ ziextract() {
|
|||
((#i)*.tar.7z|(#i)*.t7z)
|
||||
→zinit-extract() { →zinit-check 7z "$file" || return 1; command 7z x -so "$file" | command tar --no-same-owner -xf -; }
|
||||
;;
|
||||
((#i)*.tar.zst)
|
||||
→zinit-extract() { →zinit-check zstd "$file" || return 1; command zstd -dc "$file" | command tar --no-same-owner -xf -; }
|
||||
;;
|
||||
((#i)*.tar)
|
||||
→zinit-extract() { →zinit-check tar "$file" || return 1; command tar --no-same-owner -xf "$file"; }
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -2713,7 +2713,7 @@ zinit() {
|
|||
light "--help|-b|-h"
|
||||
snippet "--command|--force|--help|-f|-h|-x"
|
||||
times "--help|-h|-m|-s"
|
||||
self-update "--help|--quiet|-h|-q"
|
||||
self-update "--help|--no-pager|--quiet|-h|-n|-q"
|
||||
unload "--help|--quiet|-h|-q"
|
||||
update "--all|--help|--no-pager|--parallel|--plugins|--quiet|--reset|--snippets|--urge|--verbose|-L|-a|-h|-n|-p|-q|-r|-s|-u|-v"
|
||||
version ""
|
||||
|
|
|
|||
Loading…
Reference in a new issue