From d2f447e44513080b23303432587fa813d3586224 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 29 Nov 2014 13:56:28 +0100 Subject: [PATCH] Use ${PWD:A} when checking for leave event Use the absolute path when comparing to the absolute path of the previously entered dirs. --- autoenv.zsh | 2 +- tests/cwd.t | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/autoenv.zsh b/autoenv.zsh index f770d8a..1211f9c 100644 --- a/autoenv.zsh +++ b/autoenv.zsh @@ -261,7 +261,7 @@ _autoenv_chpwd_handler() { 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 ea77aa0..32687c2 100644 --- a/tests/cwd.t +++ b/tests/cwd.t @@ -24,3 +24,14 @@ The actual tests. $ 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 . -- 2.44.0