3dab7e46e8815838c8099040e11a7ae9a30ba03d

Author
dt-rush <nick.8.payne@gmail.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

unset chpwd_functions before running cd to work with the path, to avoid side-effects if the user has set any chpwd_functions which cause output, such as is the case if the user is using auto-ls (#6830)

Diff

 1diff --git a/plugins/shrink-path/shrink-path.plugin.zsh b/plugins/shrink-path/shrink-path.plugin.zsh
 2index f111962a57aa839a8649da7a298613a90ea0982a..6dd6a930f751cefa883696e193b575b5ebf6703e 100644
 3--- a/plugins/shrink-path/shrink-path.plugin.zsh
 4+++ b/plugins/shrink-path/shrink-path.plugin.zsh
 5@@ -94,6 +94,11 @@ shrink_path () {
 6         (( tilde )) && dir=${dir/$HOME/\~}
 7         tree=(${(s:/:)dir})
 8         (
 9+                # unset chpwd_functions since we'll be calling `cd` and don't
10+                # want any side-effects (eg., if the user was using auto-ls)
11+                chpwd_functions=()
12+                # unset chpwd since even if chpwd_functions is (), zsh will
13+                # attempt to execute chpwd
14                 unfunction chpwd 2> /dev/null
15                 if [[ $tree[1] == \~* ]] {
16                         cd ${~tree[1]}