Skip to content

Commit 1ec0446

Browse files
committed
FIX: Ensure path when normpath-ing git project root
Avoids: TypeError: expected str, bytes or os.PathLike object, not NoneType
1 parent bec6307 commit 1ec0446

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pdoc/html_helpers.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,17 +594,15 @@ def _git_project_root():
594594
"""
595595
Return the path to project root directory or None if indeterminate.
596596
"""
597-
path = None
598597
for cmd in (['git', 'rev-parse', '--show-superproject-working-tree'],
599598
['git', 'rev-parse', '--show-toplevel']):
600599
try:
601600
path = subprocess.check_output(cmd, universal_newlines=True).rstrip('\r\n')
602601
if path:
603-
break
602+
return os.path.normpath(path)
604603
except (subprocess.CalledProcessError, OSError):
605604
pass
606-
path = os.path.normpath(path)
607-
return path
605+
return None
608606

609607

610608
@lru_cache()

0 commit comments

Comments
 (0)