Unset ENV_NAME & deactivate if no virtualenv found
This addresses #4603 without breaking current behaviour (where current behaviour is correct). When changing directories, if there is no environment matching ENV_NAME, ENV_NAME is emptied and deactivate called if there is a current environment active (based on CD_VIRTUAL_ENV).
This commit is contained in:
parent
9a2d1d6790
commit
cc9695b081
@ -60,9 +60,13 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
||||
workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
|
||||
elif [[ -e "$ENV_NAME/bin/activate" ]]; then
|
||||
source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
|
||||
else
|
||||
ENV_NAME=""
|
||||
fi
|
||||
fi
|
||||
elif [[ -n $CD_VIRTUAL_ENV && -n $VIRTUAL_ENV ]]; then
|
||||
fi
|
||||
|
||||
if [[ "$ENV_NAME" == "" && -n $CD_VIRTUAL_ENV && -n $VIRTUAL_ENV ]]; then
|
||||
# We've just left the repo, deactivate the environment
|
||||
# Note: this only happens if the virtualenv was activated automatically
|
||||
deactivate && unset CD_VIRTUAL_ENV
|
||||
|
Loading…
Reference in New Issue
Block a user