mirror of
https://github.com/Tarrasch/zsh-autoenv.git
synced 2024-11-26 00:40:59 +02:00
Use ${PWD:A} when checking for leave event
Use the absolute path when comparing to the absolute path of the previously entered dirs.
This commit is contained in:
parent
c2a3009d4a
commit
d2f447e445
@ -261,7 +261,7 @@ _autoenv_chpwd_handler() {
|
|||||||
local prev_file prev_dir
|
local prev_file prev_dir
|
||||||
for prev_file in ${_autoenv_stack_entered}; do
|
for prev_file in ${_autoenv_stack_entered}; do
|
||||||
prev_dir=${prev_file:A:h}
|
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
|
local env_file_leave=$prev_dir/$AUTOENV_FILE_LEAVE
|
||||||
if _autoenv_check_authorized_env_file $env_file_leave; then
|
if _autoenv_check_authorized_env_file $env_file_leave; then
|
||||||
_autoenv_source $env_file_leave leave $prev_dir
|
_autoenv_source $env_file_leave leave $prev_dir
|
||||||
|
11
tests/cwd.t
11
tests/cwd.t
@ -24,3 +24,14 @@ The actual tests.
|
|||||||
|
|
||||||
$ cd sub/sub2
|
$ cd sub/sub2
|
||||||
ENTERED: PWD:sub from:cwd.t to: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 .
|
||||||
|
Loading…
Reference in New Issue
Block a user