Skip to main content

Module git_diff

Module git_diff 

Source

Modules§

content
Bounded content read beside the stats scan: what a seat’s changed files say, as raw unified-diff hunks.
file
One file’s whole content at a revision, as its lines.
hunks
Per-file hunk scanner for the /diff overlay.
resolver
Re-anchoring resolver for durable review threads.

Structs§

BaseMeasurement
One completed base refresh: when it measured, what it found, and git’s own words when it could not run.
BaseRefresh
What one base refresh answered.

Enums§

NumstatError
Underlying git diff --numstat subprocess didn’t return a usable result. Callers map this to LayerState::ScanFailed so the renderer can surface the failure. The variants carry enough classification to triage from the log emitted by run_git; downstream callers don’t differentiate them today but the type keeps the option open.

Constants§

SCAN_WORST_CASE
One scan’s worst case for the shape SCAN_CHILDREN counts, which is what a test waiting on a scan derives its own bound from. Test-only: production reads the per-child budget, never the count.

Functions§

changed_file_count
How many files cwd’s worktree has changed against HEAD: tracked modifications plus untracked files, one --porcelain line each. Err carries the repo gate, so a caller can tell “not a repo” from a git that would not run rather than reading either as a clean tree.
clear_git_point_for_tests
Drop cwd’s pointer, back to the machine’s git.
current_branch
Run the full scan sequence against cwd and return a snapshot. Always succeeds - every failure path collapses to a non-InRepo repo_gate and a log line naming the step that failed. Callers should treat the snapshot as authoritative for rendering regardless of which variant came back.
last_base_measurement
This checkout’s last completed refresh of default_branch. None until one has completed; a reader applies measurement_in_window itself, since the store only prunes on write.
point_git_at_for_tests
Point cwd’s git spawns at program: the testing feature’s seam, so a crate whose fixtures need a held child drives the same wrapper this crate’s own tests do. Pair with clear_git_point_for_tests.
pr_refresh_due
Whether a scan’s PR block is past its refetch window, so a scan that may reach the network would look it up again.
refresh_base_for_display
Answer the base a drawn branch diff is measured against, and keep it fresh off the read.
refresh_base_now
Answer the base by running the refresh on this call: the one path that waits, for a seat with no session.
scan
env is cwd’s project’s own declared environment, carried as the identity of every gh call the scan makes, so the PR row reads as the project rather than as the server’s ambient login.
scan_pinned
A read pinned to one base revision: the branch-ahead layer is computed against base (a sha a refresh just resolved) rather than against the ref’s name, so this read and a content read taken beside it describe one commit even if the ref moves between them. Never fetches and never looks the PR up: the caller has already refreshed the base and is drawing it.
scan_serving_cached_pr
scan for a read a client is waiting on: a PR cache past its window is served for the branch and sha it belongs to rather than looked up, so the read never waits on the network; a cache from another branch or push answers nothing. The seat’s own loop scans with scan and pushes the refreshed row.
scan_without_base_fetch
scan for a read that will fetch the base itself a moment later: the same local scan with none of the background kick, so one read of a sessionless seat pays one fetch - its own - and never queues that fetch behind forge’s on the shared per-repository gate.