find_project_root: allow .git to be a file (#1217)

Fixes #1213
This commit is contained in:
hauntsaninja 2020-01-02 14:33:30 -08:00 committed by Jelle Zijlstra
parent 7af619b8c1
commit 1ab87a3f67

View File

@ -3597,7 +3597,7 @@ def find_project_root(srcs: Iterable[str]) -> Path:
# Append a fake file so `parents` below returns `common_base_dir`, too.
common_base /= "fake-file"
for directory in common_base.parents:
if (directory / ".git").is_dir():
if (directory / ".git").exists():
return directory
if (directory / ".hg").is_dir():