Skip to main content

canonical_repo

Function canonical_repo 

Source
pub fn canonical_repo(raw: &str) -> Result<String, String>
Expand description

Canonical repository name for a path a client sent: owner/repo.git, the same spelling the smart-HTTP path derives from a URL.

The spelling matters beyond tidiness. Ref names in the op log are <repo>:<refname> with <repo> in exactly this form, so a shim that normalized differently would push into a second, parallel namespace that looks fine in isolation and never converges with the HTTP one.

Both owner/repo and owner/repo.git are accepted, because both are spellings humans type. Two segments are required: a grant cannot be written for any other shape (see crate::acl), so a deeper path could never be authorized anyway.

ยงErrors

Returns a message naming what is wrong with the path.