MCPcopy Index your code
hub / github.com/garrytan/gstack / fileChangedSinceState

Function fileChangedSinceState

bin/gstack-memory-ingest.ts:326–343  ·  view source on GitHub ↗
(path: string, state: IngestState)

Source from the content-addressed store, hash-verified

324}
325
326function fileChangedSinceState(path: string, state: IngestState): boolean {
327 const entry = state.sessions[path];
328 if (!entry) return true;
329 try {
330 const st = statSync(path);
331 const mtimeNs = Math.floor(st.mtimeMs * 1e6);
332 if (mtimeNs === entry.mtime_ns) return false;
333 const sha = fileSha256(path);
334 if (sha === entry.sha256) {
335 // mtime changed but content didn't; just refresh mtime to skip future hashing
336 entry.mtime_ns = mtimeNs;
337 return false;
338 }
339 return true;
340 } catch {
341 return true;
342 }
343}
344
345// ── Walkers ────────────────────────────────────────────────────────────────
346

Callers 2

probeModeFunction · 0.85
preparePagesFunction · 0.85

Calls 1

fileSha256Function · 0.85

Tested by

no test coverage detected