The fixture leaves the sandbox clone one commit behind a scratch bare
upstream built with git commit-tree from HEAD's own tree, so the
fast-forward pull moves only the branch pointer: the unstaged diff the
bootstrap applies stays intact and nothing needs restoring when an
assertion aborts a test. Works offline and on detached-HEAD checkouts
(CI pull_request) alike; a less() shadow function detects pager
invocation, and ambient pull.rebase/autostash settings are pinned off
in the clone so the pull output is stable across machines.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
When the checkout is behind upstream, the commit-log display piped
through .zinit-pager unconditionally, so self-update -q (and the quiet
.zinit-self-update call made by update --all) could hang in less until
dismissed. Skip the display, munging included, under --quiet.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
Issue #632: the pager machinery already recognized -n/--no-pager
globally and .zinit-pager already honors OPTS[opt_-n,--no-pager], but
self-update rejected the flag with "Incorrect options given". Allow it
so the commit list can be printed straight to the terminal; help and
error output pick the flag up automatically from the option map. Also
offer the flag in the _zinit completion.
Closes#632
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
Raises the gh-r suite's GitHub API budget from the anonymous
60 requests/hour/IP to 1,000/hour, so release lookups no longer
depend on unauthenticated HTML scraping that gets throttled when
concurrent runs share runner egress IPs.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
.zinit-download-file-stdout made every request anonymously and gave
up on the first transient error. The gh-r test suite alone exceeds
GitHub's anonymous API limit of 60 requests/hour/IP, and racing CI
runs trip per-IP abuse throttling, failing whole zunit slices (run
33138613456: 28 failures, all rate-limited downloads).
Send Authorization from GITHUB_TOKEN/GH_TOKEN, strictly limited to
api.github.com so tokens never reach asset CDNs, mirrors, or snippet
hosts, and retry transient HTTP errors in curl and wget.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
End-to-end test for the ziextract non-archive fallback using
pkgforge-dev/ghostty-appimage: the downloaded AppImage is not an
archive, so it must be kept as a plain file, marked executable,
and renamed by the mv ice. Asserts on files only; the Linux-only
binary is never executed since CI also runs on macOS.
Closes: https://github.com/zdharma-continuum/zinit/issues/775
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
is_not_value_in builds an associative array from its arguments, so it
died on an odd element count, which made the test depend on how many
completions earlier suites had installed. It also compared a bare name
against full paths, so it never caught a wrongly installed completion.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
Eight tests repeated the same four-line block asserting PWD, OLDPWD and
where cd - lands. Move it beside _oldpwd_fixture in @setup and drop the
comment paragraphs that restate the traps documented in tests/CLAUDE.md.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
Drop the anonymous-function indirection in .zinit-cd-quiet and pass --,
collapse the duplicated landing cd in .zinit-restore-dir, and convert the
six remaining hand-rolled copies of the idiom in zinit-install.zsh to the
named helper.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
atclone evals inline, unlike the atpull hooks, which go through
.zinit-at-eval and get a function frame that absorbs a return from the
ice body. Wrap the eval so the restore runs on every path.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
${ICE[atinit#!]} subscripts a literal "atinit#!" key and expands to
nothing, so atinit'!...' never ran for as"command" plugins.
${ICE[atinit]#1} stripped a leading "1" instead of "!", leaving the bang
in the evaluated code. Both now strip the prefix they meant to.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
The ___moved guard skipped the restore whenever zinit did not cd
itself, so an ice body that cds under nocd stranded the shell wherever
the plugin left it. Make the restore unconditional and give
.zinit-restore-dir a fast path so the case where nothing moved stays
free.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
The second test runs `zsh -c', which sources $HOME/.zshenv, so the
developer's own rc file would otherwise leak into $output and $state.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
With the text attribute set, core.autocrlf=false hands the decision to
core.eol, so a global core.eol=crlf still produces CRLF checkouts in the
sandbox clones.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
wait-invalid-suffix-x asserted on 'Expected one of: a, b, c', but
+zi-log colourises each suffix letter separately, so the raw output
carries escape sequences between them and no such contiguous substring
exists. Strip the escapes before asserting on the sentence.
for-invalid-as asserted rc 0 while the load ran on to
∞zinit-compile-plugin-hook, which returns 1 for this fixture ("No files
for compilation found") and made `zinit for' exit 1 for a reason
unrelated to the invalid ice under test. Add nocompile so the test
measures ice validation only.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
@setup bodies run under ERR_EXIT. Sourcing zinit.zsh trips it partway
through, so the setup aborted and zunit reported both tests as failures
with an empty message -- which read as a broken assertion rather than a
broken fixture. The source was redundant anyway: the bootstrap already
sources zinit from the sandbox clone.
Drop the ZINIT[BIN_DIR]="$PWD" override with it. It aimed the tests at
the real checkout instead of the sandbox, the same misdirection that
lets a failed bootstrap write into the working tree. Neither test calls
a zinit function; only the hook registries are needed.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
Covers atload, atinit and multisrc, the nocd branch, a since-deleted
$OLDPWD, an $OLDPWD that started unset, and the configure hook.
Each test asserts where `cd -' actually lands, not just the value of
$OLDPWD: `cd -' reads zsh's internal previous-directory state, so a
parameter-only assertion passes against a fix that merely assigns
$OLDPWD while leaving the bug in place. All seven fail without the
preceding two commits.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
∞zinit-configure-base-hook cd'd into the plugin directory inside a plain
{ } block -- not a subshell -- and every one of its four return paths
left the shell parked there. A `zinit update' on a plugin using the
configure ice moved the user's shell and never moved it back.
Wrap the block in an always clause so the directory is restored on all
paths, and use .zinit-cd-quiet instead of a bare `cd --', which was also
firing chpwd hooks and AUTO_PUSHD.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
Every ice that runs code inside a plugin or snippet directory (atinit,
atload, multisrc, atclone, atpull, ps-on-unload) saved and restored $PWD
around the temporary cd, but never $OLDPWD. `cd -q' suppresses chpwd
hooks and `noautopushd' suppresses the directory stack, but neither
suppresses $OLDPWD, so the cd back left it pointing at the directory
just visited. Opening a new shell and pressing `cd -' jumped into a
zinit plugin directory without the user ever having gone there.
Add .zinit-cd-quiet/.zinit-restore-dir, which return to the original
$PWD by cd'ing through the original $OLDPWD for real. A plain $OLDPWD
assignment is not enough: `cd -' reads zsh's internal previous-directory
state, not the parameter, so assigning it leaves the parameter looking
correct while `cd -' still navigates to the plugin directory. When the
original $OLDPWD is empty or has since been deleted, bounce through
$PWD instead, which degrades `cd -' to a harmless no-op rather than
emitting an error and leaking the plugin directory anyway.
Also gate the restore on the cd having actually happened. It ran
unconditionally, so with the nocd ice -- where no cd takes place -- the
no-op cd back to $PWD still set OLDPWD=$PWD, silently discarding the
user's real previous directory.
Sites already protected by a real subshell, and the user-facing `zinit
cd' and `zinit create' commands that are meant to leave you in the
target directory, are left untouched.
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
- Check out zdharma-continuum/zunit at feat/run-tests-in-parallel-support and
run the gh-r and plugins suites with --slice
- Pin Homebrew/actions/setup-homebrew to a commit SHA and enable its sandbox
- Drop ncurses from the brew install list, relink it explicitly, and add
jemalloc; set HOMEBREW_NO_REQUIRE_TAP_TRUST
- Expand the OS matrix to "${os}-latest" and label jobs as "<test> | <os>"
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>