MCPcopy Index your code
hub / github.com/codeaashu/claude-code / mergeFileStateCaches

Function mergeFileStateCaches

src/utils/fileStateCache.ts:129–142  ·  view source on GitHub ↗
(
  first: FileStateCache,
  second: FileStateCache,
)

Source from the content-addressed store, hash-verified

127
128// Merge two file state caches, with more recent entries (by timestamp) overriding older ones
129export function mergeFileStateCaches(
130 first: FileStateCache,
131 second: FileStateCache,
132): FileStateCache {
133 const merged = cloneFileStateCache(first)
134 for (const [filePath, fileState] of second.entries()) {
135 const existing = merged.get(filePath)
136 // Only override if the new entry is more recent
137 if (!existing || fileState.timestamp > existing.timestamp) {
138 merged.set(filePath, fileState)
139 }
140 }
141 return merged
142}
143

Callers 3

REPLFunction · 0.85
drainCommandQueueFunction · 0.85
handleSpeculationAcceptFunction · 0.85

Calls 4

cloneFileStateCacheFunction · 0.85
entriesMethod · 0.80
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected