INNER CODE UNIT · TypeScript
jjOldSideCacheKey
modem-dev/hunk · packages/hunk-jj/src/index.ts:72
function jjOldSideCacheKey(oldCommitIds: string[]) {
return oldCommitIds.length === 1
? `commit:${oldCommitIds[0]}`
: `merged-parents:${oldCommitIds.join(",")}`;
}
/**
* Let Hunk load complete file text when a user expands context omitted from the patch.
*
* `jj diff` includes changed lines and only a few unchanged lines around them. When the
* user expands a collapsed gap, Hunk calls `readFileSource` for the rest of the file.
* This reader uses commit IDs resolved before the patch was generated, so the returned
* text still matches the review even if `@` or a bookmark has moved. The cache key names
* both sides of that resolved diff so Hunk never carries source text across a change to
* either side.
*
* With exactly one parent, the old text comes from that commit and the new text comes
* from the reviewed commit. The old side of a rename uses `previousPath`; added files