MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / parse_git_remote

Function parse_git_remote

src/cli/run/helpers/parse_git_remote.rs:49–63  ·  view source on GitHub ↗
(remote: &str)

Source from the content-addressed store, hash-verified

47}
48
49pub fn parse_git_remote(remote: &str) -> Result<GitRemote> {
50 let captures = REMOTE_REGEX.captures(remote).ok_or_else(|| {
51 anyhow!("Could not extract owner and repository from remote url: {remote}")
52 })?;
53
54 let domain = captures.name("domain").unwrap().as_str();
55 let owner = captures.name("owner").unwrap().as_str();
56 let repository = captures.name("repository").unwrap().as_str();
57
58 Ok(GitRemote {
59 domain: domain.to_string(),
60 owner: owner.to_string(),
61 repository: repository.to_string(),
62 })
63}
64
65#[cfg(test)]
66mod tests {

Callers 3

try_fromMethod · 0.85
test_parse_git_remoteFunction · 0.85

Calls 2

as_strMethod · 0.80
nameMethod · 0.45

Tested by 1

test_parse_git_remoteFunction · 0.68