Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

#133

Serve the repository overview from stored summaries

merged · by keenan 9d ago · merged into main at 2a8f7cef by keenan 9d ago

keenan opened this 9d ago

Why

Closes #132. The repository overview read git on every request: rev-parse for the tip, log for five commits, for-each-ref for tags, ls-tree plus shortlog for languages and contributors, and cat-file for the README. Only the README is not a property of a ref, and refs move only when a push lands.

This is stacked on #131 (the head summary) because it uses the repos.head_sha comparison to decide whether the stored summary belongs to the tip being shown. Base is index/head-summary; #131 should merge first.

What changed

  • Schema v10: repo_languages, repo_commits, repo_contributors, repo_tags. They are derived rows, deleted with the rest on a schema bump or vole admin index rebuild.
  • RefreshHead now stores the tip’s five newest commits and its language breakdown from one ls-tree -r -l, and reports whether the tip moved. RefreshContributors stores the top eight authors; the hook calls it only when the tip changed, so a metadata or tag push never runs shortlog.
  • RefreshTags stores the tag rows beside the release events it already rewrote. IndexRepo now refreshes tags and contributors too, so a rebuild restores everything a push would have written.
  • The overview reads those rows when Entry.HeadSHA equals the actual branch tip (read with RefCommit, a loose-ref file read) and falls back to git when it does not. If one stored section is empty on a repository with commits, that section alone is re-read from git, so a failed shortlog or tree walk does not leave a blank forever.
  • Sidebar: Filter.Limit/RequestFilter.Limit let the overview ask for the five open rows it shows instead of sorting the whole queue in memory.
  • README: rendered HTML is cached by repository, commit and ref under a byte budget (8 MiB / 512 entries), and a repository with no README remembers that too instead of trying four names on every visit.
  • Fallback languages now read one ls-tree -r -l rather than ls-tree plus a cat-file --batch-check.
  • Remove deletes every derived row for a repository, not only its repos row.

Measurement

Load harness, concurrency 4, three repositories, five seconds:

before after
overview 473 req/s, p50 8 ms ~740 req/s, p50 5 ms
home 749 req/s, p50 5 ms 737 req/s, p50 5 ms
activity 762 req/s 763 req/s
instance activity 482 req/s 816 req/s

git-children sampled during the overview run: 0.

Tests

  • TestRefreshHeadStoresRecentCommitsAndLanguages (order, subjects, language bytes, and that a repeat at the same tip reports no change).
  • TestRefreshContributorsStoresAuthors.
  • TestRefreshTagsStoresTagsAndReleaseEvents (annotated vs lightweight, moved and deleted tags).
  • TestReadmeCacheEvictsOldEntries (byte budget).
  • The existing overview/home tests now exercise the stored rows; the full -race suite, vet, gofmt, link check, and vole workflow run verify pass.

Notes

The post-receive hook now does one shortlog per pushed default-branch tip. A push to another branch or to metadata does not pay it; a code push already pays for pack processing and the index refresh, and the alternative is paying it on a page read for every process.

Discussion (0)

No discussion yet.