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 ¶
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.
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.
func (*TransportSet) Valid ¶
func (t *TransportSet) Valid(transport string) bool
Valid returns true if transport is a known Git URL scheme and false if not.