MCPcopy Index your code
hub / github.com/go-task/task / CacheKey

Method CacheKey

taskfile/node_git.go:219–228  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

217}
218
219func (node *GitNode) CacheKey() string {
220 checksum := strings.TrimRight(checksum([]byte(node.Location())), "=")
221 lastDir := filepath.Base(filepath.Dir(node.path))
222 prefix := filepath.Base(node.path)
223 // Means it's not "", nor "." nor "/", so it's a valid directory
224 if len(lastDir) > 1 {
225 prefix = fmt.Sprintf("%s.%s", lastDir, prefix)
226 }
227 return fmt.Sprintf("git.%s.%s.%s", node.url.Host, prefix, checksum)
228}
229
230// repoCacheKey generates a unique cache key for the repository+ref combination.
231// Unlike CacheKey() which includes the file path, this identifies the repository itself.

Callers 1

TestGitNode_CacheKeyFunction · 0.95

Calls 3

LocationMethod · 0.95
checksumFunction · 0.85
DirMethod · 0.65

Tested by 1

TestGitNode_CacheKeyFunction · 0.76