Skip to content
quarry View Ticket
Login

View Ticket

2026-09-24
00:52 • Ticket [32709698c6] Language breakdown bar for a repository status still Open with 1 other change artifact: ab541a5a26 user: zeitgeist
2026-08-19
13:03 • Ticket [32709698c6]: 2 changes artifact: 8592651ce8 user: dmestas
12:10 • Ticket [32709698c6]: 1 change artifact: 6557262e22 user: dmestas
11:04 • Ticket [32709698c6]: 2 changes artifact: 422c5beadc user: dmestas
2026-08-18
19:22 • New ticket [32709698c6]. artifact: 356c70987e user: dmestas

Language breakdown bar for a repository

Open32709698c64db4c07b07eef89b0c70250fa21118Created 104.2 days agoUpdated 67.9 days ago
Description2026-08-18 19:22:38
Forgejo shows a colour bar of the languages in a repository. The data source is the tip tree, which quarry can already list.

The cost is not the classification — extension-to-language is a lookup table — but that byte counts per file require reading the tree, and 0001 §2 means every file goes through a `zit cat` subprocess. For sqlite that is 2,219 spawns.

Two things make it affordable:

- `zit ls` already reports sizes, so the bar can be built from extension plus size WITHOUT reading any file contents. That is one subprocess, not thousands. It misclassifies files whose extension lies, which for a language bar is an acceptable error. - The result is a pure function of a resolved check-in, exactly like an archive, so it caches under the same rule and never needs invalidating.

Recommend the `zit ls` route: one call, cacheable forever per check-in, and no new dependency. Show it as the strip forgejo uses but with the legend inline rather than on hover, so it is readable on touch.

2026-08-19 13:03:30

Design, now that the About panel (#765689a7ac) gives this a home:

Classification is by file extension over the tip's tree listing — which is already fetched and memoized per tip, so the raw material is free. Extension → language table for the common few dozen; files that match nothing fall into no bucket rather than "Other" lying about precision. Sizes come from the long listing, so the bar is weighted by BYTES like GitHub's, not file count.

Where it computes: a memo keyed on the tip hash (the leaves memo pattern) — the answer is immutable per tip, so it is computed once per push, not per render. No index schema change, no fold work: this is a pure derivation over the listing.

Vendored noise: GitHub uses .gitattributes linguist overrides; our analogue is a "languages": {"exclude": ["vendor/", "fixtures/"]} key in .quarry/repo.json — same file, same read path as everything else. Defaults to no exclusions; a wrong bar is visible and fixable by commit.

Display: one stacked bar + the top 6 with percentages, exactly the GitHub shape. Colors from a fixed language→hue table, falling back to branchHue(name) so unknown languages get a stable color for free.