Documentation
¶
Overview ¶
Package repourl decides whether two spellings of a Git repository URL name the same repository.
One repository has many spellings: GitHub hands out https://github.com/acme/platform.git, git@github.com:acme/platform.git and https://github.com/acme/platform in the same payload, and a GitProvider's spec.url can be any of them. Comparing the strings would call those three different repositories, so a relay that names the repository one way would be ignored for a provider that spells it another.
The comparison is deliberately loose about transport and strict about identity: scheme, userinfo, default ports, a trailing ".git" and case are dropped, while the host, a non-default port and the path are kept. Case is dropped from the path too, because the hosts this is used with (GitHub, GitLab, Gitea) resolve repository paths case-insensitively.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Normalize ¶
Normalize returns the canonical "host[:port]/path" form of a repository URL, or "" for an empty one. It accepts URL forms (https://, http://, ssh://, git://) and the scp-like SSH form "[user@]host:path". A string it cannot parse is returned lowercased and trimmed, so it can still only ever equal itself.
Types ¶
This section is empty.