autoenv.zsh | 2 +- tests/cwd.t | 11 +++++++++++ diff --git a/autoenv.zsh b/autoenv.zsh index f770d8a3f8f203a231a7ba817f73922f5c9079d1..1211f9c2ba43a181b503e4be4fbd930e61208c9b 100644 --- a/autoenv.zsh +++ b/autoenv.zsh @@ -261,7 +261,7 @@ if [[ $AUTOENV_HANDLE_LEAVE == 1 ]] && (( $#_autoenv_stack_entered )); then local prev_file prev_dir for prev_file in ${_autoenv_stack_entered}; do prev_dir=${prev_file:A:h} - if ! [[ ${PWD}/ == ${prev_dir}/* ]]; then + if ! [[ ${PWD:A}/ == ${prev_dir}/* ]]; then local env_file_leave=$prev_dir/$AUTOENV_FILE_LEAVE if _autoenv_check_authorized_env_file $env_file_leave; then _autoenv_source $env_file_leave leave $prev_dir diff --git a/tests/cwd.t b/tests/cwd.t index ea77aa0dffe702a7dc6056ef2273fcceb5fc049d..32687c219e4c708b0022e7394475b3237fd2333f 100644 --- a/tests/cwd.t +++ b/tests/cwd.t @@ -24,3 +24,14 @@ LEFT: PWD:sub from:sub to:cwd.t $ cd sub/sub2 ENTERED: PWD:sub from:cwd.t to:sub2 + +Check that symlinked dirs get handled correctly. + + $ cd ../.. + LEFT: PWD:sub from:sub2 to:cwd.t + $ ln -s sub sub_linked + $ cd sub_linked + ENTERED: PWD:sub from:cwd.t to:sub_linked + $ cd sub2 + ENTERED: PWD:sub from:sub_linked to:sub2 + $ cd .