( entrypoint string, dir string, insecure bool, opts ...NodeOption, )
| 59 | } |
| 60 | |
| 61 | func 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 | |
| 93 | func (node *GitNode) Location() string { |
| 94 | return node.rawUrl |
searching dependent graphs…