MCPcopy
hub / github.com/go-task/task / NewGitNode

Function NewGitNode

taskfile/node_git.go:61–91  ·  view source on GitHub ↗
(
	entrypoint string,
	dir string,
	insecure bool,
	opts ...NodeOption,
)

Source from the content-addressed store, hash-verified

59}
60
61func NewGitNode(
62 entrypoint string,
63 dir string,
64 insecure bool,
65 opts ...NodeOption,
66) (*GitNode, error) {
67 base := NewBaseNode(dir, opts...)
68 u, err := giturls.Parse(entrypoint)
69 if err != nil {
70 return nil, err
71 }
72
73 basePath, path := splitURLOnDoubleSlash(u)
74 ref := u.Query().Get("ref")
75
76 rawUrl := u.Redacted()
77
78 u.RawQuery = ""
79 u.Path = basePath
80
81 if u.Scheme == "http" && !insecure {
82 return nil, &errors.TaskfileNotSecureError{URI: u.Redacted()}
83 }
84 return &GitNode{
85 baseNode: base,
86 url: u,
87 rawUrl: rawUrl,
88 ref: ref,
89 path: path,
90 }, nil
91}
92
93func (node *GitNode) Location() string {
94 return node.rawUrl

Calls 3

NewBaseNodeFunction · 0.85
splitURLOnDoubleSlashFunction · 0.85
GetMethod · 0.45

Tested by 13

TestGitNode_sshFunction · 0.68
TestGitNode_sshWithDirFunction · 0.68
TestGitNode_httpsFunction · 0.68
TestGitNode_httpsWithDirFunction · 0.68
TestGitNode_CacheKeyFunction · 0.68
TestGitNode_buildURLFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…