Skip to content

Commit 34c9d72

Browse files
committed
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.
1 parent 56c0376 commit 34c9d72

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/poetry/core/vcs/git.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,10 @@ def executable() -> str:
168168
if not path:
169169
continue
170170

171-
_path = Path(path.strip())
172-
try:
173-
_path.relative_to(Path.cwd())
174-
except ValueError:
171+
_path = Path(path.strip()).resolve()
172+
# Skip git in the current directory
173+
if _path != Path.cwd().resolve() / "git.exe":
175174
_executable = str(_path)
176-
177175
break
178176
else:
179177
_executable = "git"

0 commit comments

Comments
 (0)