(repo_root: pathlib.Path)
| 21 | |
| 22 | |
| 23 | def _resolve_git_dir(repo_root: pathlib.Path) -> pathlib.Path | None: |
| 24 | git_path = repo_root / ".git" |
| 25 | if git_path.is_dir(): |
| 26 | return git_path |
| 27 | if git_path.is_file(): |
| 28 | gitdir_line = git_path.read_text().splitlines()[0] |
| 29 | if gitdir_line.startswith("gitdir: "): |
| 30 | git_dir = pathlib.Path(gitdir_line.removeprefix("gitdir: ").strip()) |
| 31 | if not git_dir.is_absolute(): |
| 32 | git_dir = (repo_root / git_dir).resolve() |
| 33 | return git_dir |
| 34 | return None |
| 35 | |
| 36 | |
| 37 | def get_remote_url(git_dir: pathlib.Path, remote_name: str = "origin") -> str | None: |
no outgoing calls
no test coverage detected