Skip to main content

Module graph

Module graph 

Source
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:

  1. “commit line” — one column per active lane: * for the commit’s lane, | for others.
  2. “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§

DecoratedCommit
One commit with everything a TUI row needs: graph topology + decorations.
GraphCommit
GraphRow

Enums§

GraphStyle
Visual glyph set for the graph. Pure data, no rendering — render reads 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.