Expand description
Commit graph rendering — lane-based ASCII like git log --graph --all.
Pure logic, no TUI / git2 dependency. Take a topologically-sorted slice of
GraphCommit (id + parent ids), produce a Vec<GraphRow> whose
lane_glyphs field is the prefix to render before the commit subject.
Rendering vocabulary (single-cell glyphs + spaces between lanes):
* the active commit on its lane
| a continuing lane
\\ lane joining to the right (merge incoming or fork)
/ lane joining to the left (merge incoming from right or fork)
empty lane
Each row produces TWO lines:
- “commit line” — one column per active lane:
*for the commit’s lane,|for others. - “transition line” (optional) — only present when lanes split or merge
between this commit and the next. Shows
\///|joins.
For simplicity:
- commit’s first parent inherits its lane;
- extra parents (merge) open new lanes to the right;
- when a lane’s tip is no longer referenced by any later commit, it closes
on the next transition line as
/joining toward its first-parent lane.
Structs§
- Decorated
Commit - One commit with everything a TUI row needs: graph topology + decorations.
- Graph
Commit - Graph
Row
Enums§
- Graph
Style - Visual glyph set for the graph. Pure data, no rendering —
renderreads the glyphs from the supplied set when emitting commit / transition lines.
Functions§
- format_
ref_ badge - Format a single ref label with a leading icon for visual scanning. Used by both CLI graph output and TUI graph view.
- lane_
color - Map an arbitrary lane index to a stable ANSI 256 color. Useful for TUI callers that want consistent colour-per-lane across renders.
- padding_
row - Build a “breather” row that mirrors the current lanes but only shows vertical glyphs — useful for expanded styles (BubblesX) which insert one or more padding rows between commits to leave breathing room.
- ref_
badge_ color - Color hint for a ref badge (ANSI 256). Brand-consistent: HEAD bright, tags gold, branches cyan. Currently used only by the TUI badge renderer (planned); CLI prints unstyled badges.
- render
- Render the commit graph using the default ASCII style. Kept for callers
that don’t need to choose a style. New code should prefer
render_with. - render_
repo - Convenience: walk + render with default ASCII style.
- render_
repo_ with - Walk + render with a chosen glyph style.
- render_
with - Render the commit graph for an ordered list of commits with a chosen glyph style.
- walk_
repo - Walk repository commits topologically and decorate with refs/tags.