cd_hook: do not invoke actions if in a bash subshell

This commit is contained in:
Josh Holtrop 2014-03-07 10:52:36 -05:00
parent 628094554b
commit 206a087d54

View File

@ -93,10 +93,13 @@ function cd_hook_show_git_status()
} }
function cd_hook() function cd_hook()
{ {
if [[ "${cd_hook_last_wd}" != "${PWD}" ]]; then if [[ $BASH_SUBSHELL == 0 ]]; then
cd_hook_cat_todo # do not invoke these CD hooks in subshells
cd_hook_show_git_status if [[ "${cd_hook_last_wd}" != "${PWD}" ]]; then
cd_hook_last_wd="${PWD}" cd_hook_cat_todo
cd_hook_show_git_status
cd_hook_last_wd="${PWD}"
fi
fi fi
} }
# Invoke cd_hook when we're loaded # Invoke cd_hook when we're loaded