MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / mergeFileStateCaches

Function mergeFileStateCaches

source code/utils/fileStateCache.ts:131–144  ·  view source on GitHub ↗
(
  first: FileStateCache,
  second: FileStateCache,
)

Source from the content-addressed store, hash-verified

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

Callers 3

REPLFunction · 0.85
drainCommandQueueFunction · 0.85
handleSpeculationAcceptFunction · 0.85

Calls 4

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

Tested by

no test coverage detected