Skip to main content

Module backend

Module backend 

Source
Expand description

The repository abstraction journey’s UI talks to.

The UI never touches git2 directly — it goes through RepoBackend. That keeps the widget code testable: snapshot tests render the real UI against a deterministic fixture::FixtureBackend instead of needing a live repository with machine-dependent SHAs and timestamps.

Re-exports§

pub use fixture::FixtureBackend;
pub use patch::PartialMode;
pub use patch::build_partial_patch;
pub use patch::is_change_line;

Modules§

fixture
An in-memory RepoBackend for tests and demos.
patch
Reconstructs a minimal unified-diff patch covering only a selected range of lines, so the commit screen can stage or unstage part of a file instead of the whole thing — the engine behind the Stage/Unstage button that floats over a highlighted region in the diff view.

Structs§

CommitInfo
Everything the UI needs to show about a single commit.
Diff
A whole diff, ready to render line-by-line.
DiffLine
One rendered line of a unified diff.
FileChange
One changed path in a commit’s diff against its first parent.
Git2Backend
Opens a repository and reads commits/diffs through libgit2.
RefLabel
A branch / tag / HEAD label attached to a commit row.
WorkingStatus
A snapshot of the working tree for commit mode (à la git gui).

Enums§

ChangeStatus
How a file changed in a commit.
DiffLineKind
The semantic class of a single line in a unified diff. Drives coloring in the DiffView widget.
RefKind
What a ref pointing at a commit is.

Traits§

RepoBackend
The interface the UI layer depends on. Implemented by the live Git2Backend and the in-memory FixtureBackend.

Functions§

format_git_time
Format a Unix timestamp (+ minute offset) as YYYY-MM-DD HH:MM:SS ±HHMM in the given timezone, with no external date crate. Uses Howard Hinnant’s civil-from-days algorithm so it is correct for the full proleptic Gregorian range.