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/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

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

Serve repositories from the root of the URL space

ed03b3d1fa16ef6b55e2773aaf10e3be13282c3a · Keenan Nemetz · 4h ago · parent d37d301f

Serve repositories from the root of the URL space

A repository is now /<name> and its Git transport /<name>.git, so the URL a
person opens, the URL a clone uses, and the Go module path are the same name.
The forge's own pages moved under /-/ (admin, accounts, the directory, the
feed, sign-in, assets), a prefix no repository name can start with: names are
[a-z0-9...] and cannot begin with "-". That leaves the router with two disjoint
spaces and removes the /r/ and /git/ prefixes, which existed only to keep
repositories away from the forge's own paths.

Routes: repoRoutes lose /r/; global, auth and admin routes gain /-/; assets
move to /-/static/ because a subtree pattern like /static/ cannot coexist with
one-segment-wildcard repo routes — Go's mux reports them as conflicting
neither-more-specific patterns. The catch-all still renders the styled 404.

Transport: githttp.Route parses /<name>.git/<rest> instead of a /git/ prefix,
and forgepaths.go hands such requests to the proxy before the mux, because a
wildcard fills a whole segment and cannot match "<name>.git". LFS stays on the
mux (<name>.git/info/lfs/...), and the Go module discovery probe moves to the
same pre-router so a package path under a public repository is answered even
when its first segments name a page tab.

Names: repo.ValidateName now refuses the four root paths the forge must keep —
static, robots.txt, sitemap.xml, sitemap-pages.xml. Everything else is an
ordinary repository name, including admin, u, and activity.

Docs and the packaged URLs follow the new layout; robots.txt, the sitemaps and
the instance activity feed point at the new paths. No aliases: the old /r/ and
/git/ URLs are gone.

Verified with ./vole workflow check and ./vole workflow run verify.

server/web/writes.go +12−12

@@ -60,7 +60,7 @@ func (w *Web) CreateIssue(rw http.ResponseWriter, r *http.Request) {
60 60 return
61 61 }
62 62 w.audit("web.issue.create", ctx.Name, m.Name, iss.ID)
63 http.Redirect(rw, r, "/r/"+m.Name+"/issues/"+iss.ID, http.StatusSeeOther)
63 http.Redirect(rw, r, "/"+m.Name+"/issues/"+iss.ID, http.StatusSeeOther)
64 64 }
65 65
66 66 // SetIssueLabels replaces an issue's labels. Labels are shared state, but the
@@ -107,7 +107,7 @@ func (w *Web) SetIssueLabels(rw http.ResponseWriter, r *http.Request) {
107 107 w.render(rw, "issue_labels", w.issueSidebar(r, m, updated, ""), 0)
108 108 return
109 109 }
110 http.Redirect(rw, r, "/r/"+m.Name+"/issues/"+id, http.StatusSeeOther)
110 http.Redirect(rw, r, "/"+m.Name+"/issues/"+id, http.StatusSeeOther)
111 111 }
112 112
113 113 // SetIssueAssignees replaces an issue's assignees. Same rule as labels: the
@@ -159,7 +159,7 @@ func (w *Web) SetIssueAssignees(rw http.ResponseWriter, r *http.Request) {
159 159 w.render(rw, "issue_assignees", w.issueSidebar(r, m, updated, ""), 0)
160 160 return
161 161 }
162 http.Redirect(rw, r, "/r/"+m.Name+"/issues/"+id, http.StatusSeeOther)
162 http.Redirect(rw, r, "/"+m.Name+"/issues/"+id, http.StatusSeeOther)
163 163 }
164 164
165 165 func (w *Web) ApproveRequest(rw http.ResponseWriter, r *http.Request) {
@@ -216,7 +216,7 @@ func (w *Web) ApproveRequest(rw http.ResponseWriter, r *http.Request) {
216 216 w.render(rw, "request_live_write", w.requestLiveWrite(r, m, updated, ""), 0)
217 217 return
218 218 }
219 http.Redirect(rw, r, "/r/"+m.Name+"/changes/"+id, http.StatusSeeOther)
219 http.Redirect(rw, r, "/"+m.Name+"/changes/"+id, http.StatusSeeOther)
220 220 }
221 221
222 222 // CreateChangeRequest is the browser counterpart of `vole change new`. The head
@@ -297,7 +297,7 @@ func (w *Web) CreateChangeRequest(rw http.ResponseWriter, r *http.Request) {
297 297 if problems := metadata.ValidateRequests(m.Git(), metadata.Ref); len(problems) > 0 {
298 298 w.Logger("web: request %s left the request tree invalid: %v", req.ID, problems)
299 299 }
300 http.Redirect(rw, r, "/r/"+m.Name+"/changes/"+req.ID, http.StatusSeeOther)
300 http.Redirect(rw, r, "/"+m.Name+"/changes/"+req.ID, http.StatusSeeOther)
301 301 }
302 302
303 303 // ChangeIssueState closes or reopens an issue. The author can do this without a
@@ -330,7 +330,7 @@ func (w *Web) ChangeIssueState(rw http.ResponseWriter, r *http.Request) {
330 330 return
331 331 }
332 332 w.audit("web.issue.state", ctx.Name, m.Name, id+" "+state)
333 http.Redirect(rw, r, "/r/"+m.Name+"/issues/"+id, http.StatusSeeOther)
333 http.Redirect(rw, r, "/"+m.Name+"/issues/"+id, http.StatusSeeOther)
334 334 }
335 335
336 336 // ChangeRequestState closes or reopens a change request. Closing is not merging:
@@ -365,7 +365,7 @@ func (w *Web) ChangeRequestState(rw http.ResponseWriter, r *http.Request) {
365 365 if problems := metadata.ValidateRequests(m.Git(), metadata.Ref); len(problems) > 0 {
366 366 w.Logger("web: request state %s left the request tree invalid: %v", id, problems)
367 367 }
368 http.Redirect(rw, r, "/r/"+m.Name+"/changes/"+id, http.StatusSeeOther)
368 http.Redirect(rw, r, "/"+m.Name+"/changes/"+id, http.StatusSeeOther)
369 369 }
370 370
371 371 // UpdateRequestTarget moves an open request's base and the branch it follows. The
@@ -451,7 +451,7 @@ func (w *Web) UpdateRequestTarget(rw http.ResponseWriter, r *http.Request) {
451 451 w.Logger("web: request target %s left the request tree invalid: %v", id, problems)
452 452 }
453 453 }
454 http.Redirect(rw, r, "/r/"+m.Name+"/changes/"+id, http.StatusSeeOther)
454 http.Redirect(rw, r, "/"+m.Name+"/changes/"+id, http.StatusSeeOther)
455 455 }
456 456
457 457 // UpdateRequestIssues adds or removes one issue linked to an open change request.
@@ -535,7 +535,7 @@ func (w *Web) UpdateRequestIssues(rw http.ResponseWriter, r *http.Request) {
535 535 w.render(rw, "request_issues", w.requestSidebar(r, m, updated, "", ""), 0)
536 536 return
537 537 }
538 http.Redirect(rw, r, "/r/"+m.Name+"/changes/"+id, http.StatusSeeOther)
538 http.Redirect(rw, r, "/"+m.Name+"/changes/"+id, http.StatusSeeOther)
539 539 }
540 540
541 541 // landGate is the landing gate wired to the stores this process already holds. The
@@ -636,7 +636,7 @@ func (w *Web) MergeRequest(rw http.ResponseWriter, r *http.Request) {
636 636 w.Logger("web: merge left the request tree invalid: %v", problems)
637 637 }
638 638 // The redirect shows the request page, which now reads as merged.
639 http.Redirect(rw, r, "/r/"+m.Name+"/changes/"+id, http.StatusSeeOther)
639 http.Redirect(rw, r, "/"+m.Name+"/changes/"+id, http.StatusSeeOther)
640 640 }
641 641
642 642 // armMerge records "merge when ready" and answers the click. The intent is a wait,
@@ -657,7 +657,7 @@ func (w *Web) armMerge(rw http.ResponseWriter, r *http.Request, m *repo.Meta, re
657 657 w.render(rw, "request_live_write", view, 0)
658 658 return
659 659 }
660 http.Redirect(rw, r, "/r/"+m.Name+"/changes/"+req.ID+"?merging=1", http.StatusSeeOther)
660 http.Redirect(rw, r, "/"+m.Name+"/changes/"+req.ID+"?merging=1", http.StatusSeeOther)
661 661 }
662 662
663 663 // CancelMerge turns off merge-when-ready. It cannot cancel a landing that already
@@ -682,7 +682,7 @@ func (w *Web) CancelMerge(rw http.ResponseWriter, r *http.Request) {
682 682 return
683 683 }
684 684 w.audit("web.request.merge_cancel", ctx.Name, m.Name, id)
685 http.Redirect(rw, r, "/r/"+m.Name+"/changes/"+id, http.StatusSeeOther)
685 http.Redirect(rw, r, "/"+m.Name+"/changes/"+id, http.StatusSeeOther)
686 686 }
687 687
688 688 // mergeRefused renders a refusal where the reader can see the review, the conflict