Why
Closes #130. The landing card showed the default branch tip (SHA, subject,
author, time) and the language the repository is mostly made of by reading git
on every home page render: symbolic-ref, rev-parse, log -1 and
ls-tree -r per repository. Those facts change only when a push moves the
branch.
What changed
reposgainshead_sha,head_subject,head_author,head_when,languageandlang_class;index.Entryreturns them with the rest of the row.Store.RefreshHeadrecomputes the summary. It compares the recorded tip with the branch tip first, so a metadata or tag push costs onerev-parseand no tree walk. It runs from post-receive (every push), from the rebuild (IndexRepo/vole admin index rebuild), and after a default branch change in settings.- The language mapping moved to
internal/lang, shared by the web pages and the summary;languageForandfileClassare now one table. - The home card reads head, language, counts, ACL and newest event time from the index. The home page starts no git process. The all-git card builder stays as the fallback for a Web without an index.
Measurement
Load harness, concurrency 4, three repositories:
| before | after | |
|---|---|---|
| home | 243 req/s, p50 16 ms | 749 req/s, p50 5 ms |
git-children sampled during the run: 0.
Tests
TestRefreshHeadRecordsTheDefaultBranch: tip, subject, author, time, language and class from a pushed main branch.TestRefreshHeadClearsADeletedBranch.TestIndexRepoRestoresTheHeadSummary.- Existing home card and top-language tests now exercise the hook’s summary;
the language table’s tests moved to
internal/lang. - Full
-racesuite, vet, gofmt, link check.
Follow-up
internal/lang is the one place the display name and CSS class live now; a
future language addition is one switch.