Skip to main content

scan

Function scan 

Source
pub async fn scan(cwd: &Path, target: &str) -> ScanOutcome
Expand description

Top-level scanner entry. target is a plain ref / SHA / "HEAD" (not a ../... range - the helper diff_ref_spec picks the shape for us). "HEAD" runs a two-dot working-tree diff (uncommitted only); any other ref runs git diff <target>...HEAD, the three-dot form that surfaces what THIS branch contributed vs the merge-base with target. Three-dot matches the Inspector GIT panel’s branch-ahead scanner (which composes format!("{default}...HEAD") via the same helper), so the panel and overlay agree on what’s diffable even after a squash-merge where two-dot git diff main HEAD would be empty.

Returns a ScanOutcome - files carries one FileHunks per changed file in the order git diff --name-status reports them (untracked files when target == "HEAD" come at the end as FileStatus::Untracked), scanner_ok is false when any subprocess hit Failed/Oversize so the caller can surface “scan failed, check logs” rather than miscategorising the empty result as “no changes.”