fix(zoxide): restore CDPATH support in cd/z execution #14

Merged
rootiest merged 1 commits from fix/cdpath-cd-execution into main 2026-05-12 04:45:48 +00:00
Owner

Summary

  • Fixes a regression introduced in #13 where cd subdir (or z subdir) silently fell through to zoxide query instead of resolving against CDPATH entries
  • Completions already showed the correct CDPATH candidates; only execution was broken
  • The z function now mirrors the completion logic: check direct path → check each CDPATH prefix → fall back to zoxide query

Manual Verification

  • Set CDPATH to include a parent directory (e.g. set -x CDPATH /some/parent)
  • Run cd subdir where subdir exists under that CDPATH parent but not in $PWD
  • Confirm you land in /some/parent/subdir (previously this silently queried zoxide and either went somewhere wrong or failed)
  • Confirm cd . and cd ~ (zero-arg / $HOME) still work
  • Confirm cd - (previous dir) still works
  • Confirm a zoxide fuzzy match (e.g. cd proj for a frecent path) still works when there's no matching CDPATH directory
  • Confirm tab-completion still shows CWD, CDPATH, and zoxide candidates
## Summary - Fixes a regression introduced in #13 where `cd subdir` (or `z subdir`) silently fell through to zoxide query instead of resolving against `CDPATH` entries - Completions already showed the correct CDPATH candidates; only execution was broken - The `z` function now mirrors the completion logic: check direct path → check each CDPATH prefix → fall back to zoxide query ## Manual Verification - [x] Set `CDPATH` to include a parent directory (e.g. `set -x CDPATH /some/parent`) - [x] Run `cd subdir` where `subdir` exists under that CDPATH parent but **not** in `$PWD` - [x] Confirm you land in `/some/parent/subdir` (previously this silently queried zoxide and either went somewhere wrong or failed) - [x] Confirm `cd .` and `cd ~` (zero-arg / `$HOME`) still work - [x] Confirm `cd -` (previous dir) still works - [x] Confirm a zoxide fuzzy match (e.g. `cd proj` for a frecent path) still works when there's no matching CDPATH directory - [x] Confirm tab-completion still shows CWD, CDPATH, and zoxide candidates
rootiest added 1 commit 2026-05-12 04:44:28 +00:00
The CDPATH regression was introduced when unifying completions: the `z`
function only checked `test -d` (absolute path existence) before falling
through to zoxide query, silently ignoring CDPATH-relative directories.
Now mirrors the completion logic — checks direct path, then each CDPATH
prefix, then zoxide — so `cd subdir` resolves correctly when `subdir`
lives under a CDPATH entry.
rootiest merged commit be051daf1e into main 2026-05-12 04:45:48 +00:00
rootiest deleted branch fix/cdpath-cd-execution 2026-05-12 04:45:48 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rootiest/fish-config#14