repoCacheKey generates a unique cache key for the repository+ref combination. Unlike CacheKey() which includes the file path, this identifies the repository itself. Two GitNodes with the same repo+ref but different file paths will share the same cache. Returns a path like: github.com/user/repo.git/
()
| 233 | // |
| 234 | // Returns a path like: github.com/user/repo.git/main |
| 235 | func (node *GitNode) repoCacheKey() string { |
| 236 | repoPath := strings.Trim(node.url.Path, "/") |
| 237 | |
| 238 | ref := node.ref |
| 239 | if ref == "" { |
| 240 | ref = "_default_" // Placeholder for the remote's default branch |
| 241 | } |
| 242 | |
| 243 | return filepath.Join(node.url.Host, repoPath, ref) |
| 244 | } |
| 245 | |
| 246 | func splitURLOnDoubleSlash(u *url.URL) (string, string) { |
| 247 | x := strings.Split(u.Path, "//") |
no outgoing calls