From 34c9d7244b7a13a11d6faa6a327823dbebdd183e Mon Sep 17 00:00:00 2001 From: Bryce Guinta Date: Mon, 11 Dec 2023 20:28:49 -0700 Subject: [PATCH] Fix issue with creating new projects Windows The previous code contained a bug where git couldn't reside in relative subdirectory. It appears to have done this in attempt to get the absolute path of the git executable. Instead, I just use resolve to resolve potential symlinks, etc. --- src/poetry/core/vcs/git.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/poetry/core/vcs/git.py b/src/poetry/core/vcs/git.py index 1d44d5f49..71e0542c7 100644 --- a/src/poetry/core/vcs/git.py +++ b/src/poetry/core/vcs/git.py @@ -168,12 +168,10 @@ def executable() -> str: if not path: continue - _path = Path(path.strip()) - try: - _path.relative_to(Path.cwd()) - except ValueError: + _path = Path(path.strip()).resolve() + # Skip git in the current directory + if _path != Path.cwd().resolve() / "git.exe": _executable = str(_path) - break else: _executable = "git"