Skip to main content

parse_remote_web_base

Function parse_remote_web_base 

Source
pub fn parse_remote_web_base(url: &str) -> Option<String>
Expand description

Convert a git remote URL into its web base (https://host/owner/repo), regardless of SCM host.

Accepts HTTPS (https://host/owner/repo.git) and SSH (git@host:owner/repo.git) forms, normalizes both to https://host/owner/repo (no .git suffix), and preserves nested groups (group/subgroup/repo). Returns None when the URL has no recognizable host or path.

This is the host-preserving counterpart of parse_remote_owner_repo: it keeps the host so callers (e.g. changelog compare-link footers) can build links against a self-hosted GitLab/Gitea instead of assuming github.com.