MCPcopy Create free account
hub / github.com/LaunchPlatform/beanhub-cli / _resolve_git_dir

Function _resolve_git_dir

beanhub_cli/git_repo.py:23–34  ·  view source on GitHub ↗
(repo_root: pathlib.Path)

Source from the content-addressed store, hash-verified

21
22
23def _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
37def get_remote_url(git_dir: pathlib.Path, remote_name: str = "origin") -> str | None:

Callers 1

resolve_repo_from_gitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected