(start: Path)
| 399 | |
| 400 | |
| 401 | def find_repo_root(start: Path) -> Path: |
| 402 | cur = start.resolve() |
| 403 | for _ in range(50): |
| 404 | if (cur / ".git").exists(): |
| 405 | return cur |
| 406 | if cur.parent == cur: |
| 407 | break |
| 408 | cur = cur.parent |
| 409 | code, out, _err = _run_git(["rev-parse", "--show-toplevel"], cwd=start) |
| 410 | if code == 0 and out: |
| 411 | return Path(out).resolve() |
| 412 | raise RuntimeError("Could not locate repository root") |
| 413 | |
| 414 | |
| 415 | def glob_paths(repo_root: Path, patterns: list[str]) -> list[Path]: |