MCPcopy Create free account
hub / github.com/modem-dev/hunk / patchFingerprint

Function patchFingerprint

src/ui/diff/useHighlightedDiff.ts:70–78  ·  view source on GitHub ↗

Content fingerprint from the diff patch. Changes whenever the underlying diff * changes, allowing per-file cache invalidation without a global flush.

(file: DiffFile)

Source from the content-addressed store, hash-verified

68/** Content fingerprint from the diff patch. Changes whenever the underlying diff
69 * changes, allowing per-file cache invalidation without a global flush. */
70function patchFingerprint(file: DiffFile) {
71 const { patch } = file;
72 if (patch.length === 0) {
73 return metadataFingerprint(file);
74 }
75
76 const mid = Math.floor(patch.length / 2);
77 return `${patch.length}:${patch.slice(0, 64)}:${patch.slice(mid, mid + 64)}:${patch.slice(-64)}`;
78}
79
80/** Cache key that includes a content fingerprint so stale entries are never served
81 * after reload. Unchanged files keep their cache hit across reloads. */

Callers 1

buildCacheKeyFunction · 0.85

Calls 1

metadataFingerprintFunction · 0.85

Tested by

no test coverage detected