Skip to main content

Module git

Module git 

Source
Expand description

Git repository inspection state via gix.

Canonical definition: docs/specs/git-segments.md §GitContext type.

Two tiers of laziness. DataContext::git decides whether to open the repo at all. Once opened, GitContext exposes lazy dirty and upstream accessors so segments that don’t read those fields skip the scan entirely.

Structs§

DirtyCounts
Per-category dirty counts. Populated only in counts mode; indicator-mode scans leave this absent.
GitContext
Git state shared across all git_* segments for the duration of one render invocation. Populated once by resolve_repo and held behind an Arc in DataContext.
UpstreamState
Upstream-tracking branch comparison.

Enums§

DirtyState
Dirty-state result.
Head
Resolved HEAD state.
RepoKind
Which flavor of repository gix::discover found.

Functions§

resolve_repo
Walk up from cwd looking for a repository. Returns Ok(None) only for the legitimate “no repo here” cases (no .git found walking up). Permission errors, trust rejections (safe.directory), ceiling-dir misconfig, and path-input errors surface as GitError::CorruptRepo so they reach the user instead of silently hiding the segment.