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,11 +93,14 @@ function cd_hook_show_git_status()
}
function cd_hook()
{
if [[ $BASH_SUBSHELL == 0 ]]; then
# do not invoke these CD hooks in subshells
if [[ "${cd_hook_last_wd}" != "${PWD}" ]]; then
cd_hook_cat_todo
cd_hook_show_git_status
cd_hook_last_wd="${PWD}"
fi
fi
}
# Invoke cd_hook when we're loaded
cd_hook