| 103 | } |
| 104 | |
| 105 | func (node *GitNode) buildURL() string { |
| 106 | // Get the base URL |
| 107 | baseURL := node.url.String() |
| 108 | |
| 109 | // Always use git:: prefix for git URLs (following Terraform's pattern) |
| 110 | // This forces go-getter to use git protocol |
| 111 | if node.ref != "" { |
| 112 | return fmt.Sprintf("git::%s?ref=%s&depth=1", baseURL, node.ref) |
| 113 | } |
| 114 | // When no ref is specified, omit it entirely to let git clone the default branch |
| 115 | return fmt.Sprintf("git::%s?depth=1", baseURL) |
| 116 | } |
| 117 | |
| 118 | // getOrCloneRepo returns the path to a cached git repository. |
| 119 | // If the repository is not cached, it clones it first. |