feat(git): lay out the commit history in lanes

Adds the three pieces the graph section needs from the data layer: the
lane assigner, the `log --pretty` parser it is fed from, and the paged
loader that puts the two together.

`LaneAlloc` is append-only. It keeps only what has to survive a page
boundary — which oid each lane is holding a place for, and the reverse
index — so a later page extends the graph instead of re-flowing the rows
already on screen. That is only possible because `GraphRow` is
row-local: a row says nothing about the rows below it, which is also why
a long-lived branch is drawn from its first row rather than staying
invisible until the page holding its parent loads.

Colour is the lane number, fixed when the lane is created. A per-branch
counter wraps at the palette size and puts branch 0 and branch N in the
same colour, which in a three-column panel is very likely two adjacent
lines; keying on the lane makes neighbours distinct by construction. The
"one branch, one colour" half falls out of the first parent inheriting
its child's lane in place. Lanes are recycled but never compacted —
compacting would move a lane out from under a row already drawn.

The log is read with RS between records and US between fields rather
than `-z`, whose record separator is NUL and so collides with the field
separator; fields are taken with `splitn` so the body absorbs any US of
its own. Paging is a larger `-n`, never `--skip`, and `HeadAndUpstream`
resolves to shas first so a push between two pages cannot shift the
window out from under page one.

The Cargo.lock line is the missing half of tty7-core picking up
smallvec, which main already carries.
This commit is contained in:
l0ng-ai
2026-08-09 00:38:54 +08:00
parent 3b3e5fa046
commit b27d0d322b
2 changed files with 1144 additions and 3 deletions
Generated
+1
View File
@@ -9740,6 +9740,7 @@ dependencies = [
"serde",
"serde_json",
"sha2 0.11.0",
"smallvec",
"smol",
"system-configuration",
"system-configuration-sys",
File diff suppressed because it is too large Load Diff