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

Method repoCacheKey

taskfile/node_git.go:235–244  ·  view source on GitHub ↗

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/

()

Source from the content-addressed store, hash-verified

233//
234// Returns a path like: github.com/user/repo.git/main
235func (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
246func splitURLOnDoubleSlash(u *url.URL) (string, string) {
247 x := strings.Split(u.Path, "//")

Calls

no outgoing calls