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.

#131

Record the default branch summary when a push lands

merged · by keenan 9d ago · merged into main at 8dc56e4e by keenan 9d ago

keenan opened this 9d ago

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

  • repos gains head_sha, head_subject, head_author, head_when, language and lang_class; index.Entry returns them with the rest of the row.
  • Store.RefreshHead recomputes the summary. It compares the recorded tip with the branch tip first, so a metadata or tag push costs one rev-parse and 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; languageFor and fileClass are 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 -race suite, 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.

Discussion (0)

No discussion yet.