Skip to main content

parse_repo_url

Function parse_repo_url 

Source
pub fn parse_repo_url(url: &str) -> Option<RepoRef>
Expand description

Parse a git remote URL into (owner, repo). Supports the four common forms:

  • https://atomgit.com/owner/repo.git
  • https://atomgit.com/owner/repo
  • git@atomgit.com:owner/repo.git
  • ssh://git@atomgit.com/owner/repo.git

Also accepts gitcode.com in any of those forms — atomgit mirrors every repo onto gitcode with the same slug, and the API always resolves against api.atomgit.com, so the host is effectively informational here.

Returns None when the URL isn’t an atomgit mirror host — used to detect “cwd is in a git repo but it’s a different host (e.g. GitHub)” and skip validation rather than false-positive.