From 1ab87a3f67bc80a2e59be2692f2e2f25dd143af7 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Thu, 2 Jan 2020 14:33:30 -0800 Subject: [PATCH] find_project_root: allow .git to be a file (#1217) Fixes #1213 --- black.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/black.py b/black.py index 1c35643..11db7e4 100644 --- a/black.py +++ b/black.py @@ -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(): -- 2.39.5