Skip to main content

remote_web_base

Function remote_web_base 

Source
pub fn remote_web_base(remote_url: &str) -> Option<(String, String)>
Expand description

Splits a git remote URL into the host’s web base (https://host, never the API root) and the project path (group/sub/proj), for building a pull/merge-request URL by hand.

Handles every spelling host_of_remote does - scp-like (git@host:group/proj.git), ssh:// (a port, if any, is dropped and the scheme is https: the ssh daemon says nothing about the web UI) and http(s):// (scheme and port are the web UI’s own, so a plain-http server in a container stays http://host:3000) - and always strips a trailing .git.