Skip to content

Fix: load completions when zcompdump is missing - #86

Merged
mrsauravsahu merged 1 commit into
mainfrom
fix/compinit-cache-glob
Sep 6, 2026
Merged

mrsauravsahu merged 1 commit into
mainfrom
fix/compinit-cache-glob

Conversation

@mrsauravsahu

@mrsauravsahu mrsauravsahu commented Sep 6, 2026 •

Copy link
Copy Markdown
Owner

The compinit cache check used [[ -n ${dump}(#qN.mh+24) ]]. With EXTENDED_GLOB set the qualifier does match, so fresh and stale dumps were routed correctly, but a missing dump also produced an empty match and fell to the compinit -C branch. -C skips the dump rebuild entirely, so a first run on a new machine, or any run after the dump was deleted, came up with no completions loaded and stayed that way until the file happened to reappear.

Match through an array and invert the condition so the fast path is taken only on a positive match:

fresh (<24h) -> compinit -C
stale (>24h) -> compinit + touch
missing -> compinit + touch

Also pass -d explicitly so both branches agree on the dump path, and save and restore EXTENDED_GLOB instead of unconditionally unsetting an option the user's own config may have enabled.

The compinit cache check used `[[ -n ${dump}(#qN.mh+24) ]]`. With
EXTENDED_GLOB set the qualifier does match, so fresh and stale dumps were
routed correctly, but a *missing* dump also produced an empty match and
fell to the `compinit -C` branch. `-C` skips the dump rebuild entirely, so
a first run on a new machine, or any run after the dump was deleted, came
up with no completions loaded and stayed that way until the file happened
to reappear.

Match through an array and invert the condition so the fast path is taken
only on a positive match:

  fresh (<24h) -> compinit -C
  stale (>24h) -> compinit + touch
  missing      -> compinit + touch

Also pass -d explicitly so both branches agree on the dump path, and save
and restore EXTENDED_GLOB instead of unconditionally unsetting an option
the user's own config may have enabled.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017opPVGYfryqcV8BAt66zqW
@mrsauravsahu
mrsauravsahu merged commit 252ec25 into main Sep 6, 2026
1 check passed
@mrsauravsahu
mrsauravsahu deleted the fix/compinit-cache-glob branch September 6, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant