pub struct GitDiffSnapshot {
pub branch: GitBranch,
pub pushed_sha: Option<String>,
pub pr_fetched_at: Option<SystemTime>,
pub default_branch: Option<String>,
pub repo_gate: RepoGate,
pub worktree: LayerState<GitDiffStats>,
pub branch_ahead: LayerState<GitBranchAhead>,
pub pr: Option<GitPrInfo>,
pub closes: Vec<GitIssueRef>,
}Expand description
Snapshot of one project’s git state, suitable for rendering in the Inspector pane’s GIT section. Branch info is folded in here so a single polled scan covers everything the renderer needs.
worktree and branch_ahead are independent: a worker on a
topic branch with uncommitted edits surfaces both layers, while
the lead on main with a clean tree surfaces neither.
repo_gate makes the repo-vs-scanner-failure states exclusive at
the type level. The remaining cross-field invariant the scanner
upholds: branch_ahead is only Populated when default_branch
resolved (the renderer’s tuple-match relies on it), and the layer
states / pr / closes / default_branch stay empty unless
repo_gate is RepoGate::InRepo.
Fields§
§branch: GitBranchCurrent branch (Named / Detached / NoRepo / Unknown).
pushed_sha: Option<String>HEAD’s newest pushed ancestor at scan time: the first sha of
HEAD’s first-parent history the remote already tracks. None
when nothing is pushed, the walk failed, or the PR lookup was
skipped (default branch / detached). The PR cache key rides on
this rather than the branch name, so a worktree whose local
branch differs from the PR’s head ref still resolves its PR.
pr_fetched_at: Option<SystemTime>Wall-clock stamp of the last PR-lookup attempt, Some even
when the attempt found nothing or failed - the refetch timer
must rate-limit failed lookups too or a persistent gh
failure hammers every 10 s scan. None when the PR side never
ran (non-repo, default branch, detached).
default_branch: Option<String>Resolved default branch (e.g. main, master), if known.
None when origin/HEAD is missing AND neither main nor
master exists as a local ref.
repo_gate: RepoGateRepo gate: in-repo, not-a-repo, or scanner-failed. Replaces the
old in_repo + scanner_ok bool pair so the illegal
“in a repo but the scanner failed” combination can’t be built.
worktree: LayerState<GitDiffStats>Layer 1: uncommitted edits vs HEAD.
branch_ahead: LayerState<GitBranchAhead>Layer 2: commits the current branch has ahead of
default_branch. The commit count is exposed separately
from the file stats because --numstat collapses every
commit into a single stat block; the count tells the
renderer “this many commits produced these stats”.
pr: Option<GitPrInfo>Open pull request containing the current branch’s newest
pushed ancestor, if one exists. Only populated for Named
non-default branches; None otherwise. Cached across scans
while the branch name and pushed sha both hold and the fetch
is less than 5 minutes old (see the scanner’s prev
parameter).
closes: Vec<GitIssueRef>Issues the open PR closes (from GitHub’s
closingIssuesReferences). Empty when there’s no PR or the
PR doesn’t reference any issues. Cached alongside pr.
Trait Implementations§
Source§impl Clone for GitDiffSnapshot
impl Clone for GitDiffSnapshot
Source§impl Debug for GitDiffSnapshot
impl Debug for GitDiffSnapshot
impl Eq for GitDiffSnapshot
Source§impl PartialEq for GitDiffSnapshot
impl PartialEq for GitDiffSnapshot
impl StructuralPartialEq for GitDiffSnapshot
Auto Trait Implementations§
impl Freeze for GitDiffSnapshot
impl RefUnwindSafe for GitDiffSnapshot
impl Send for GitDiffSnapshot
impl Sync for GitDiffSnapshot
impl Unpin for GitDiffSnapshot
impl UnsafeUnpin for GitDiffSnapshot
impl UnwindSafe for GitDiffSnapshot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.