MCPcopy Index your code
hub / github.com/dagger/dagger / ParseURL

Function ParseURL

util/gitutil/url.go:116–134  ·  view source on GitHub ↗

ParseURL parses a BuildKit-style Git URL (that may contain additional fragment metadata) and returns a parsed GitURL object.

(remote string)

Source from the content-addressed store, hash-verified

114// ParseURL parses a BuildKit-style Git URL (that may contain additional
115// fragment metadata) and returns a parsed GitURL object.
116func ParseURL(remote string) (*GitURL, error) {
117 if proto := protoRegexp.FindString(remote); proto != "" {
118 proto = strings.ToLower(strings.TrimSuffix(proto, "://"))
119 if _, ok := supportedProtos[proto]; !ok {
120 return nil, fmt.Errorf("%w %q", ErrInvalidProtocol, proto)
121 }
122 url, err := url.Parse(remote)
123 if err != nil {
124 return nil, err
125 }
126 return fromURL(url), nil
127 }
128
129 if url, err := sshutil.ParseSCPStyleURL(remote); err == nil {
130 return fromSCPStyleURL(url), nil
131 }
132
133 return nil, ErrUnknownProtocol
134}
135
136// cloneURLFallbackProtocols is the priority order for resolving a clone ref
137// that omits its scheme (e.g. "github.com/foo/bar"). Callers iterate the

Callers 15

DecodePersistedObjectMethod · 0.92
loadContextualGitArgMethod · 0.92
TestIsRemotePublicMethod · 0.92
gitMethod · 0.92
fileMethod · 0.92
directoryMethod · 0.92
gitRepositoryMethod · 0.92
gitRefMethod · 0.92
parseWorkspaceRemoteRefFunction · 0.92
parseFlagValueMethod · 0.92
originToPathFunction · 0.92
TestGitSourceArgRefFunction · 0.92

Calls 4

ParseSCPStyleURLFunction · 0.92
ParseMethod · 0.80
fromURLFunction · 0.70
fromSCPStyleURLFunction · 0.70

Tested by 4

TestIsRemotePublicMethod · 0.74
TestGitSourceArgRefFunction · 0.74
TestParseGitFunction · 0.74
TestParseURLFunction · 0.56