change: parse repository root

This commit is contained in:
aclist committed 2026-11-09 11:03:50 +09:00
1 parent 370edbe01b
commit 2479cbd41b
7 files changed
+27 -19

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
import subprocess
from pathlib import Path
def get_git_root() -> Path:
proc = subprocess.run(
["git", "rev-parse", "--show-toplevel"], capture_output=True, text=True
)
if proc.returncode != 0:
raise OSError("Failed to parse git root")
return Path(proc.stdout.rstrip())