Walk up to find .git directory.
(path: Path)
| 728 | |
| 729 | |
| 730 | def _git_root(path: Path) -> Path | None: |
| 731 | """Walk up to find .git directory.""" |
| 732 | current = path.resolve() |
| 733 | for parent in [current, *current.parents]: |
| 734 | if (parent / ".git").exists(): |
| 735 | return parent |
| 736 | return None |
| 737 | |
| 738 | |
| 739 | _WINDOWS_DRIVE_RE = re.compile(r"^[A-Za-z]:[\\/]") |