summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3258f58)
Fixes https://github.com/Tarrasch/zsh-autoenv/issues/45.
if ! [[ ${PWD}/ == ${prev_dir}/* ]]; then
local env_file_leave=$prev_dir/$AUTOENV_FILE_LEAVE
if _autoenv_check_authorized_env_file $env_file_leave; then
if ! [[ ${PWD}/ == ${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
+ varstash_dir=$prev_dir _autoenv_source $env_file_leave leave $prev_dir
fi
# Unstash any autostashed stuff.
fi
# Unstash any autostashed stuff.
--- /dev/null
+Test unstash behavior on leaving.
+
+ $ source $TESTDIR/setup.zsh || return 1
+
+Setup test environment.
+
+ $ mkdir sub
+ $ echo 'echo ENTER; stash FOO=changed' >| sub/$AUTOENV_FILE_ENTER
+ $ echo 'echo LEAVE; unstash FOO' >| sub/$AUTOENV_FILE_LEAVE
+ $ test_autoenv_auth_env_files sub
+ $ FOO=orig
+
+Activating the env stashes it and applies a new value.
+
+ $ cd sub
+ ENTER
+ $ echo $FOO
+ changed
+
+Leaving the directory unstashes it (varstash_dir is set to prev dir).
+
+ $ cd ..
+ LEAVE
+ $ echo $FOO
+ orig