| 217 | } |
| 218 | |
| 219 | func (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. |