We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e7b7f3f commit a7d0481Copy full SHA for a7d0481
1 file changed
src/extensions/score_source_code_linker/generate_source_code_links_json.py
@@ -38,12 +38,16 @@ def find_git_root(start_path: str | Path = "") -> Path | None:
38
"""Find the git root directory starting from the given path or __file__."""
39
if start_path == "":
40
start_path = __file__
41
-
42
git_root = Path(start_path).resolve()
43
while not (git_root / ".git").exists():
44
git_root = git_root.parent
45
if git_root == Path("/"):
46
- return None
+ # fallback to cwd when building with python -m sphinx docs _build -T
+ git_root = Path.cwd().resolve()
47
+ while not (git_root / ".git").exists():
48
+ git_root = git_root.parent
49
+ if git_root == Path("/"):
50
+ return None
51
return git_root
52
53
0 commit comments