Documentation
¶
Overview ¶
Package route holds the Githome web front's URL-space rules: the reserved top-level names that a user or organization login may not take, and the ref-versus-path split that the tree and blob URLs need. These are pure functions with no dependency on the router or the domain, so the route fidelity oracle tests them directly. See implementation/02 and implementation/07.
Index ¶
- func AccountSettings() string
- func Appearance() string
- func Blob(owner, name, ref, path string) string
- func Branches(owner, name string) string
- func Checks(owner, name, ref string) string
- func CommentDelete(owner, name string, number, commentID int64) string
- func CommentEdit(owner, name string, number, commentID int64) string
- func CommentReactions(owner, name string, number, commentID int64) string
- func Commits(owner, name, ref, path string) string
- func Find(owner, name, ref string) string
- func FirstSegment(p string) (head, rest string)
- func IsReservedTop(name string) bool
- func Issue(owner, name string, number int64) string
- func IssueComment(owner, name string, number, commentID int64) string
- func IssueComments(owner, name string, number int64) string
- func IssueEdit(owner, name string, number int64) string
- func IssueReactions(owner, name string, number int64) string
- func IssueState(owner, name string, number int64) string
- func IssueTitle(owner, name string, number int64) string
- func Issues(owner, name, rawQuery string) string
- func IssuesQuery(owner, name, q string) string
- func NewIssue(owner, name string) string
- func Profile(login string) string
- func ProfileTab(login, tab string) string
- func Pull(owner, name string, number int64) string
- func PullComment(owner, name string, number, commentID int64) string
- func PullComments(owner, name string, number int64) string
- func PullCommits(owner, name string, number int64) string
- func PullFiles(owner, name string, number int64) string
- func PullMerge(owner, name string, number int64) string
- func PullMergeBox(owner, name string, number int64) string
- func PullReviewComment(owner, name string, number, commentID int64) string
- func PullReviewComments(owner, name string, number int64) string
- func PullReviewReply(owner, name string, number, rootID int64) string
- func PullReviewSummary(owner, name string, number, reviewID int64) string
- func PullReviewThreadResolve(owner, name string, number, rootID int64) string
- func PullReviews(owner, name string, number int64) string
- func PullState(owner, name string, number int64) string
- func Pulls(owner, name, rawQuery string) string
- func PullsQuery(owner, name, q string) string
- func Raw(owner, name, ref, path string) string
- func Repo(owner, name string) string
- func RepoHook(owner, name string, hookID int64) string
- func RepoHookDelete(owner, name string, hookID int64) string
- func RepoHookDelivery(owner, name string, hookID, deliveryID int64) string
- func RepoHookNew(owner, name string) string
- func RepoHookRedeliver(owner, name string, hookID, deliveryID int64) string
- func RepoHooks(owner, name string) string
- func RepoSearch(owner, name, rawQuery string) string
- func RepoSettings(owner, name string) string
- func ReservedTopNames() []string
- func Search(rawQuery string) string
- func SplitRefPath(tail string, exists func(ref string) bool) (ref, path string, ok bool)
- func Tags(owner, name string) string
- func Tree(owner, name, ref, path string) string
- type RefKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountSettings ¶
func AccountSettings() string
AccountSettings is the account settings root, /settings. It redirects to the first backed section so a bookmark of the bare root keeps working.
func Appearance ¶
func Appearance() string
Appearance is the account appearance preference, /settings/appearance, where a viewer picks their color mode and the light and dark themes. It is the one account section Githome backs, since the preference rides cookies the color-mode middleware already reads.
func Checks ¶
Checks is the commit checks page, /{owner}/{repo}/checks/{ref}. ref is a branch, tag, or sha; its segments are escaped and rejoined with literal slashes so a branch with slashes round-trips through the same ref split the code views use.
func CommentDelete ¶
CommentDelete is the delete POST target for a comment, /{owner}/{repo}/issues/{number}/comments/{id}/delete (a POST, since an HTML form cannot issue DELETE without JavaScript).
func CommentEdit ¶
CommentEdit is the edit POST target for a comment, /{owner}/{repo}/issues/{number}/comments/{id}.
func CommentReactions ¶
CommentReactions is the reaction-toggle POST target for a comment, /{owner}/{repo}/issues/{number}/comments/{id}/reactions.
func Commits ¶
Commits is the history view, /{owner}/{repo}/commits/{ref}/{path}. The path is an optional history filter, so an empty path lists the whole ref history.
func FirstSegment ¶
FirstSegment returns the first path segment of p and the remainder, both without leading or trailing slashes. It is the small helper the top-level dispatcher uses to peel "/{owner}/..." without allocating a full split when only the head matters.
func IsReservedTop ¶
IsReservedTop reports whether name is a reserved first path segment. The check is case-insensitive because logins are compared case-insensitively, so a reserved name cannot be taken by changing case.
func IssueComment ¶
IssueComment is the permalink to a comment on an issue, /{owner}/{repo}/issues/{number}#issuecomment-{id}. The fragment is what the no-JS comment POST redirects to so a reload lands on the appended comment.
func IssueComments ¶
IssueComments is the new-comment POST target, /{owner}/{repo}/issues/{number}/comments.
func IssueEdit ¶
IssueEdit is the sidebar edit POST target, /{owner}/{repo}/issues/{number}/edit, which replaces the labels, assignees, or milestone through the EditIssue patch.
func IssueReactions ¶
IssueReactions is the reaction-toggle POST target for the issue body, /{owner}/{repo}/issues/{number}/reactions. The form carries the reaction content.
func IssueState ¶
IssueState is the close/reopen POST target, /{owner}/{repo}/issues/{number}/state. The form carries the target state and an optional comment body so a viewer can close with a comment in one submit.
func IssueTitle ¶
IssueTitle is the edit-title POST target, /{owner}/{repo}/issues/{number}/title.
func Issues ¶
Issues is the issues index, /{owner}/{repo}/issues. The optional rawQuery is the already-encoded ?q=/?page= filter string; an empty rawQuery yields the bare index URL the default-filter view canonicalizes to.
func IssuesQuery ¶
IssuesQuery builds the index URL for a literal ?q= filter value, encoding the query string itself so a value with spaces or quotes stays a single q parameter. It is the canonical target the filter tabs and label chips link to.
func Profile ¶
Profile is a user or organization profile, /{owner}. It is the overview tab by default; the repositories tab adds the ?tab= facet through ProfileTab.
func ProfileTab ¶
ProfileTab is a profile at a named tab, /{owner}?tab={tab}. The overview tab is the bare profile with no query, so passing "overview" (or an empty tab) yields the canonical URL rather than a redundant ?tab=overview.
func Pull ¶
Pull is the pull-request Conversation tab, /{owner}/{repo}/pull/{number}, the canonical PR page the four tabs hang off.
func PullComment ¶
PullComment is the permalink to a comment on a PR's Conversation timeline, /{owner}/{repo}/pull/{number}#issuecomment-{id}. A PR shares the issue number space, so its conversation comments carry the same issuecomment anchor the issues timeline uses; the no-JS comment POST redirects here.
func PullComments ¶
PullComments is the new-comment POST target on the Conversation tab, /{owner}/{repo}/pull/{number}/comments.
func PullCommits ¶
PullCommits is the Commits tab, /{owner}/{repo}/pull/{number}/commits.
func PullFiles ¶
PullFiles is the Files-changed tab, /{owner}/{repo}/pull/{number}/files, the code-review surface where the shared diff component renders.
func PullMerge ¶
PullMerge is the merge POST target, /{owner}/{repo}/pull/{number}/merge. The form carries the merge method, the optional commit title and message, and the expected head SHA for optimistic concurrency.
func PullMergeBox ¶
PullMergeBox is the merge-box poll fragment GET target, /{owner}/{repo}/pull/{number}/partials/merge-box. While the box is computing mergeability the component re-fetches this on a backoff; with JS off it is just the same partial the full page already shows.
func PullReviewComment ¶
PullReviewComment is the permalink to an inline review comment on the Files tab, /{owner}/{repo}/pull/{number}/files#discussion_r{id}.
func PullReviewComments ¶
PullReviewComments is the new-inline-comment POST target, /{owner}/{repo}/pull/{number}/review-comments. The form carries the anchor (path, side, line) and the head commit id the comment pins to; the domain validates the anchor against that commit's diff.
func PullReviewReply ¶
PullReviewReply is the reply POST target for an existing thread, /{owner}/{repo}/pull/{number}/review-comments/{root}/replies, where root is the thread's first comment.
func PullReviewSummary ¶
PullReviewSummary is the permalink to a submitted review in the Conversation timeline, /{owner}/{repo}/pull/{number}#pullrequestreview-{id}.
func PullReviewThreadResolve ¶
PullReviewThreadResolve is the resolve/unresolve toggle POST target for a thread, /{owner}/{repo}/pull/{number}/review-threads/{root}/resolve. The handler reads the thread's current state and flips it, so the one endpoint resolves and unresolves.
func PullReviews ¶
PullReviews is the submit-a-review POST target, /{owner}/{repo}/pull/{number}/reviews. The form carries the verdict event (approve, request changes, comment) and an optional body.
func PullState ¶
PullState is the close/reopen POST target on the Conversation tab, /{owner}/{repo}/pull/{number}/state. It is the PR's own state toggle rather than the issue's, so closing or reopening a pull request lands back on the PR page, not the issue view of the same number.
func Pulls ¶
Pulls is the pull-request index, /{owner}/{repo}/pulls. The optional rawQuery is the already-encoded ?q=/?page= filter string; an empty rawQuery yields the bare index URL the default filter canonicalizes to.
func PullsQuery ¶
PullsQuery builds the index URL for a literal ?q= filter value, encoding the query string itself so a value with spaces or quotes stays a single q parameter. It is the canonical target the state tabs link to.
func RepoHook ¶
RepoHook is one webhook's edit page, /{owner}/{repo}/settings/hooks/{hook}, keyed by its public id.
func RepoHookDelete ¶
RepoHookDelete is the delete-webhook POST target, /{owner}/{repo}/settings/hooks/{hook}/delete. Deleting is a POST, never a GET, so a crawler or a prefetch cannot remove a hook.
func RepoHookDelivery ¶
RepoHookDelivery is one recorded delivery's detail page, /{owner}/{repo}/settings/hooks/{hook}/deliveries/{delivery}.
func RepoHookNew ¶
RepoHookNew is the new-webhook form, /{owner}/{repo}/settings/hooks/new. It is a literal segment registered before the {hook} id route, so "new" is never read as an id.
func RepoHookRedeliver ¶
RepoHookRedeliver is the replay-delivery POST target, /{owner}/{repo}/settings/hooks/{hook}/deliveries/{delivery}/redeliver.
func RepoSearch ¶
RepoSearch is the in-repo results page, /{owner}/{repo}/search. The repo scope is implicit in the path, so the builder injects repo:{owner}/{name} before it runs the query; rawQuery carries only the viewer's own ?q= and the facets.
func RepoSettings ¶
RepoSettings is a repository's settings root, /{owner}/{repo}/settings. It redirects to the first backed section (the webhooks list).
func ReservedTopNames ¶
func ReservedTopNames() []string
ReservedTopNames returns the reserved names in no guaranteed order, for tests and for an admin tool that validates a requested login.
func Search ¶
Search is the global results page, /search. rawQuery is the already-encoded ?q=/?type=/?sort= string; an empty rawQuery yields the bare search landing.
func SplitRefPath ¶
SplitRefPath separates a "<ref>/<path>" tail into its git ref and the file path within that ref. A ref can contain slashes (refs/heads/feature/x, or a branch named release/1.0), so the tail is ambiguous on its own: "main/cmd/foo" could be ref "main" path "cmd/foo", or a branch "main/cmd" path "foo". Git resolves this by preferring the longest leading segment sequence that names an existing ref. exists reports whether a candidate ref resolves; the caller backs it with the repository's ref set (and the commit-ish forms it accepts, such as a full or abbreviated SHA).
It tries the whole tail as a ref first (a path-less ref URL), then peels one trailing segment at a time into the path. ok is false when no leading sequence names a ref, which the handler renders as a 404. See implementation/07 section 4.