Skip to content

Commit

Permalink
Detect infinite loop on Fish (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajeetdsouza authored Feb 23, 2024
1 parent 65941f6 commit 012c67d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed

- fish: detect infinite loop when using `alias cd=z`.

## [0.9.4] - 2024-02-21

### Changed
Expand Down
10 changes: 8 additions & 2 deletions templates/fish.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ end

# cd + custom logic based on the value of _ZO_ECHO.
function __zoxide_cd
if set -q __zoxide_loop
builtin echo "zoxide: infinite loop detected"
builtin echo "Avoid aliasing `cd` to `z` directly, use `zoxide init --cmd=cd fish` instead"
return 1
end

{%- if cfg!(windows) %}
__zoxide_cd_internal (cygpath -u $argv)
__zoxide_loop=1 __zoxide_cd_internal (cygpath -u $argv)
{%- else %}
__zoxide_cd_internal $argv
__zoxide_loop=1 __zoxide_cd_internal $argv
{%- endif %}
{%- if echo %}
and __zoxide_pwd
Expand Down

0 comments on commit 012c67d

Please sign in to comment.