diff options
author | Robby Russell <robby@planetargon.com> | 2015-06-14 22:19:23 -0700 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2015-06-14 22:19:23 -0700 |
commit | 0a8ca6adff743d38c145611377a72874d4e35414 (patch) | |
tree | 1b42333d74016d528a6a87a5e92a18c98b3952ef /plugins/virtualenvwrapper | |
parent | b55effd3bb3e9516c0f450a5938d07f19ad2a307 (diff) | |
parent | 7b478d75a3a0db466e78b6e46a0e468d64354618 (diff) | |
download | zsh-0a8ca6adff743d38c145611377a72874d4e35414.tar.gz zsh-0a8ca6adff743d38c145611377a72874d4e35414.tar.bz2 zsh-0a8ca6adff743d38c145611377a72874d4e35414.zip |
Merge pull request #3918 from cbazin/master
Detect the .venv in any parent directory of the current directory
Diffstat (limited to 'plugins/virtualenvwrapper')
-rw-r--r-- | plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index b2c804edb..9fd0d3d8f 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -37,8 +37,11 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then if [ ! $WORKON_CWD ]; then WORKON_CWD=1 # Check if this is a Git repo - PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null` - if (( $? != 0 )); then + PROJECT_ROOT=`pwd` + while [[ "$PROJECT_ROOT" != "/" && ! -e "$PROJECT_ROOT/.venv" ]]; do + PROJECT_ROOT=`realpath $PROJECT_ROOT/..` + done + if [[ "$PROJECT_ROOT" == "/" ]]; then PROJECT_ROOT="." fi # Check for virtualenv name override |