Skip to main content

Module git_state

Module git_state 

Source
Expand description

The working tree as a handoff brief reads it: branch, HEAD, the dirty paths and the diff’s stat.

Three probes rather than the diff scanner, which walks every changed file and may ask GitHub about a pull request - a brief is written in the moment a session swaps and cannot wait on either.

Re-exportsΒ§

use std::path::Path; πŸ”’
use std::time::Duration; πŸ”’
use forge_primitives::HandoffGitState; πŸ”’
use super::git_command; πŸ”’

ConstantsΒ§

DIFF_CAP πŸ”’
DIRTY_CAP πŸ”’
How many dirty paths and diff lines the brief keeps. The brief is capped by the data it names, so the read is capped here rather than by a consumer.
PROBE_TIMEOUT πŸ”’
Each probe’s own budget. A wedged git costs the brief that probe and no more; the swap is already under way when this runs.

FunctionsΒ§

capped_lines πŸ”’
The last cap non-blank lines, and how many there were in all: the part of a long list that says what the successor will meet, and the count the brief states so the cap is not read as the whole.
probe
Read the three facts. A directory that is not a repository answers with everything absent, which is a fact the brief states rather than an error.
run πŸ”’
One git line of output, or None when it failed, timed out or was empty.