pub fn normalize_git_url(url: &str) -> StringExpand description
Normalize a git remote URL to a canonical short form.
Converts common hosting URLs to compact identifiers:
git@github.com:org/repo.git->github:org/repohttps://github.com/org/repo.git->github:org/repogit@gitlab.com:org/repo.git->gitlab:org/repohttps://gitlab.com/org/repo.git->gitlab:org/repo
ยงExamples
use toolpath_git::normalize_git_url;
assert_eq!(normalize_git_url("git@github.com:org/repo.git"), "github:org/repo");
assert_eq!(normalize_git_url("https://gitlab.com/org/repo"), "gitlab:org/repo");
// Unknown hosts pass through unchanged
assert_eq!(
normalize_git_url("https://bitbucket.org/org/repo"),
"https://bitbucket.org/org/repo",
);