Skip to main content

derive_github_path

Function derive_github_path 

Source
pub fn derive_github_path(dir: &Path) -> Option<GithubPath>
Expand description

Derive a GithubPath from the git origin remote of a directory.

Why: the only I/O entry point — the workspace-root builder needs the owner/repo identity of the repo a session targets, which lives in its remote.origin.url. Shelling out to git config (rather than reading .git/config) transparently handles worktrees, where .git is a file pointing at the parent repo. What: runs git -C <dir> config --get remote.origin.url; on success parses the URL via parse_github_path. Returns None when git is absent, dir is not a repo, there is no origin remote, or the URL has no parseable identity. Best-effort, no network. Test: derive_github_path_reads_origin (temp repo with an origin remote); derive_github_path_none_outside_repo.