Fix workon_cwd to detect git subtree

In a `git subtree` working directory, `.git` is a file containing a path
to the parent git working direcotry. This change attempts to find a
virtualenv for a subtree.
This commit is contained in:
Lie Ryan 2021-07-06 21:55:10 +10:00
parent e32d4b1e19
commit a5505119dd
No known key found for this signature in database
GPG Key ID: 67ACC735F11F4E5B

View File

@ -38,7 +38,7 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
# Get absolute path, resolving symlinks
local PROJECT_ROOT="${PWD:A}"
while [[ "$PROJECT_ROOT" != "/" && ! -e "$PROJECT_ROOT/.venv" \
&& ! -d "$PROJECT_ROOT/.git" ]]; do
&& ! -e "$PROJECT_ROOT/.git" ]]; do
PROJECT_ROOT="${PROJECT_ROOT:h}"
done