Skip to main content

Module content

Module content 

Source
Expand description

Bounded content read beside the stats scan: what a seat’s changed files say, as raw unified-diff hunks.

The sibling of super::scan, not a layer inside it: the stats scan is polled (1 Hz on a moving tree, 10 s when still) and its prev is the PR-lookup cache, while this read is taken for a seat’s record on the reads that encode one - a cold load, a reconnect, a seat swap - and never polled.

One parser for both readers: the hunks and statuses are super::hunks’ own, and only the caps below are this read’s. A record is re-encoded per read and re-sent on reconnect, so no read may carry an unbounded diff, and every cap has a flag beside it rather than a silence.

Both layers the snapshot carries are read with the refs the caller has just established - HEAD for the worktree layer, and the base the drawing read refreshed for the branch-ahead one - so a file’s row and its content describe one tree, with base saying how current that base is.

Structs§

CommitContent
One commit’s own diff as bounded content.
DiffContent
The changed files of a seat’s two diff layers, bounded and flagged.
FileContent
One changed file’s bounded content.

Constants§

CONTEXT_LINES
Unified-diff context lines each per-file fetch pins. git’s own default: enough to read a change in place, small enough that a one-line edit to a huge file does not carry the file.
MAX_FILES
The most files the read fetches content for, both layers together. Each fetch is a subprocess, so this is the read’s work bound where the byte caps are its payload bound; a file past it keeps its status and is flagged truncated.
MAX_FILE_BYTES
Carried bytes per file - the cap a file of few but long lines meets first.
MAX_FILE_LINES
Carried lines per file. A generated file’s rewrite must not carry its whole body into a record that is re-sent on every subscribe.
MAX_TOTAL_BYTES
Carried line text across the whole read, both layers together. The JSON envelope the record adds beside it is not counted here; the bound is on the diff’s own content.

Functions§

scan
Read both layers of snapshot for cwd into bounded content.
scan_commit
Read one commit’s own diff as bounded content, under its own budget.
scan_commit_within
scan_commit with its command budget spelled: the budget is a bound on the machine, not on the read, spent starting each child the read spawns.
scan_within
scan with its command budget spelled; the budget bounds the machine’s start of each child, not the read’s own work.