From 685a3f16f5ccbee81be689fec5ab8ec85587d2a1 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 17 Jan 2015 16:38:40 +0100 Subject: [PATCH] Minor cleanup: centralize call to _autoenv_stack_entered_add --- autoenv.zsh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/autoenv.zsh b/autoenv.zsh index e501f90..7d6e142 100644 --- a/autoenv.zsh +++ b/autoenv.zsh @@ -31,12 +31,7 @@ autoenv_source_parent() { if [[ -n $parent_env_file ]] \ && _autoenv_check_authorized_env_file $parent_env_file; then _autoenv_debug "Calling autoenv_source_parent: parent_env_file:$parent_env_file" - - local parent_env_dir=${parent_env_file:A:h} - - _autoenv_stack_entered_add $parent_env_file - - _autoenv_source $parent_env_file enter $parent_env_dir + _autoenv_source $parent_env_file enter fi } @@ -235,6 +230,10 @@ _autoenv_source() { _autoenv_debug "== END SOURCE ==" builtin cd -q $new_dir + if [[ $autoenv_event == enter ]]; then + _autoenv_stack_entered_add $env_file + fi + # Unset vars set for enter/leave scripts. # This should not get done for recursion (via autoenv_source_parent), # and can be useful to have in general after autoenv was used. @@ -313,8 +312,6 @@ _autoenv_chpwd_handler() { return fi - _autoenv_stack_entered_add $env_file - # Source the enter env file. _autoenv_debug "Sourcing from chpwd handler: $env_file" _autoenv_source $env_file enter -- 2.44.0