Expand description
Commit-boundary file snapshots and the pure line diff over them — what
lets the generated page re-diff any contiguous commit sub-range without
touching git: the CLI collects contents once, the page (via WASM) calls
range_diff with a pair of boundary indices.
Nothing here shells out; snapshots arrive as data. Renames are not re-detected inside a sub-range — a rename shows as a delete plus an add.
Structs§
- Boundary
- The tracked files’ state at one commit boundary.
- Range
Snapshots - File contents pinned at every commit boundary of the diffed range, deduplicated by git blob id. Only paths touched by some commit in the range are tracked.
Functions§
- context_
slice - Unchanged lines shared by a file’s two endpoint snapshots — what the
page’s expand-context control reveals inside hunk gaps. Returns up to
countLine::Ctxrows starting atold_start/new_start(1-based, pre- and post-image), clamped at either file’s end. The requested region must be text-identical at both endpoints — a gap between hunks always is — so expansion can never invent or hide a change; a mismatch is rejected loudly.old_path/new_pathmay differ (renamed files). - diff_
lines - Diff two texts line-wise into hunks with
contextunchanged lines around each change — the sameHunk/Lineshapesparse_unified_diffproduces. Identical texts yield no hunks. - range_
diff - The diff between boundaries
fromandto(from < to, indices intoboundaries), as the sameFileDiffshape the build-time parser emits. Selecting commitkalone isrange_diff(snap, k - 1, k, …).