Documentation
¶
Overview ¶
Package compare holds the Githome web front's branch-comparison handlers: the branch picker that starts a comparison, and the range view that shows the three-dot diff between two branches with an optional pull-request creation form. It mirrors the repo and pulls packages: each handler loads the repository through its Resolve middleware, maps domain data into fe/view models through fe/route, and renders through fe/render. See implementation/09 section 8.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct {
Repos *domain.RepoService
Render *render.Set
View *view.Builder
Logger *slog.Logger
}
Deps are the compare handlers' dependencies.
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
Handlers is the compare handler set. One is built at boot and shared; it holds no per-request state.
func (*Handlers) Picker ¶
Picker renders the branch-picker page, GET /{owner}/{repo}/compare. When the form is submitted with base and head query params it redirects immediately to the compare range URL, so the no-JS path does not need a separate POST. An empty or uninitialized repository shows a blankslate. See implementation/09 section 8.
func (*Handlers) Range ¶
Range renders the comparison between two branches, GET /{owner}/{repo}/compare/{basehead...}. The basehead tail is parsed as "base...head" (the merge-base diff) or "base..head" (the direct diff), with each side optionally qualified as owner:ref or owner:repo:ref. With ?expand=1 the PR creation form is shown below the diff. A missing branch, a basehead that does not parse, or a qualified side naming another repository renders the soft 404. See implementation/09 section 8.