Documentation
¶
Overview ¶
Package giturls parses Git URLs.
These URLs include standard RFC 3986 URLs as well as special formats that are specific to Git. Examples are provided in the Git documentation at https://www.kernel.org/pub/software/scm/git/docs/git-clone.html.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
// Transports is a set of known Git URL schemes.
Transports = NewTransportSet(
"ssh",
"git",
"git+ssh",
"http",
"https",
)
)
Functions ¶
func Parse ¶
func Parse(rawurl string) (u *url.URL, err error)
Parse parses rawurl into a URL structure. Parse first attempts to find a standard URL with a valid Git transport as its scheme. If that cannot be found, it then attempts to find a SCP-like URL. And if that cannot be found, it assumes rawurl is a local path. If none of these rules apply, Parse returns an error.
func ParseScp ¶
func ParseScp(rawurl string) (*url.URL, error)
ParseScp parses rawurl into a URL object. The rawurl must be an SCP-like URL, otherwise ParseScp returns an error.
func ParseTransport ¶
func ParseTransport(rawurl string) (*url.URL, error)
ParseTransport parses rawurl into a URL object. Unless the URL's scheme is a known Git transport, ParseTransport returns an error.
Types ¶
type TransportSet ¶
type TransportSet struct {
Transports map[string]struct{}
}
TransportSet represents a set of valid Git transport schemes. It maps these schemes to empty structs, providing a set-like interface.
func NewTransportSet ¶
func NewTransportSet(items ...string) *TransportSet
NewTransportSet returns a TransportSet with the items keys mapped to empty struct values.