MCPcopy
hub / github.com/claude-code-best/claude-code / mergeFileStateCaches

Function mergeFileStateCaches

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

Source from the content-addressed store, hash-verified

138
139// Merge two file state caches, with more recent entries (by timestamp) overriding older ones
140export function mergeFileStateCaches(
141 first: FileStateCache,
142 second: FileStateCache,
143): FileStateCache {
144 const merged = cloneFileStateCache(first)
145 for (const [filePath, fileState] of second.entries()) {
146 const existing = merged.get(filePath)
147 // Only override if the new entry is more recent
148 if (!existing || fileState.timestamp > existing.timestamp) {
149 merged.set(filePath, fileState)
150 }
151 }
152 return merged
153}

Callers 3

REPLFunction · 0.85
drainCommandQueueFunction · 0.85
handleSpeculationAcceptFunction · 0.85

Calls 4

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

Tested by

no test coverage detected