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.

Serve repositories from the root of the URL space

ed03b3d1fa16ef6b55e2773aaf10e3be13282c3a · Keenan Nemetz · 9h 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/polish_test.go +10−10

@@ -31,10 +31,10 @@ func TestRepositorySearchOnlyFindsVisibleRepositories(t *testing.T) {
31 31 t.Fatal(err)
32 32 }
33 33
34 if _, body := f.get("/?q=notes"); !strings.Contains(body, `href="/r/notes"`) || strings.Contains(body, "secret") {
34 if _, body := f.get("/?q=notes"); !strings.Contains(body, `href="/notes"`) || strings.Contains(body, "secret") {
35 35 t.Fatalf("name search = %q", body)
36 36 }
37 if _, body := f.get("/?q=RELEASE"); !strings.Contains(body, `href="/r/notes"`) {
37 if _, body := f.get("/?q=RELEASE"); !strings.Contains(body, `href="/notes"`) {
38 38 t.Fatalf("case-insensitive description search missed notes:\n%s", body)
39 39 }
40 40 if _, body := f.get("/?q=hidden"); strings.Contains(body, "secret") {
@@ -66,14 +66,14 @@ func TestIssueListPaginates(t *testing.T) {
66 66 t.Fatalf("issues push: %s", errs)
67 67 }
68 68
69 _, page1 := f.get("/r/" + f.repo + "/issues")
69 _, page1 := f.get("/" + f.repo + "/issues")
70 70 if !strings.Contains(page1, "Issue 27") || strings.Contains(page1, "Issue 01") {
71 71 t.Fatalf("page 1 has the wrong issues:\n%s", page1)
72 72 }
73 73 if !strings.Contains(page1, "page 1 of 2") || !strings.Contains(page1, ">Next<") {
74 74 t.Fatalf("page 1 has no next link:\n%s", page1)
75 75 }
76 _, page2 := f.get("/r/" + f.repo + "/issues?page=2")
76 _, page2 := f.get("/" + f.repo + "/issues?page=2")
77 77 if !strings.Contains(page2, "Issue 01") || !strings.Contains(page2, "Issue 02") {
78 78 t.Fatalf("page 2 is missing the oldest issues:\n%s", page2)
79 79 }
@@ -98,7 +98,7 @@ func TestCodeSearchFindsNamesAndContents(t *testing.T) {
98 98 t.Fatalf("push: %s", errs)
99 99 }
100 100
101 code, body := f.get("/r/" + f.repo + "/search?q=needle&ref=main")
101 code, body := f.get("/" + f.repo + "/search?q=needle&ref=main")
102 102 if code != 200 {
103 103 t.Fatalf("search page = %d", code)
104 104 }
@@ -110,13 +110,13 @@ func TestCodeSearchFindsNamesAndContents(t *testing.T) {
110 110 if !strings.Contains(body, "main.go#L2") {
111 111 t.Fatalf("content search has no line anchor:\n%s", body)
112 112 }
113 if _, body := f.get("/r/" + f.repo + "/search?q=guide&ref=main"); !strings.Contains(body, "docs/guide.md") {
113 if _, body := f.get("/" + f.repo + "/search?q=guide&ref=main"); !strings.Contains(body, "docs/guide.md") {
114 114 t.Fatalf("file name search missed docs/guide.md:\n%s", body)
115 115 }
116 if _, body := f.get("/r/" + f.repo + "/search?q=nothingmatches&ref=main"); !strings.Contains(body, "No file names match") || !strings.Contains(body, "No file content matches") {
116 if _, body := f.get("/" + f.repo + "/search?q=nothingmatches&ref=main"); !strings.Contains(body, "No file names match") || !strings.Contains(body, "No file content matches") {
117 117 t.Fatalf("empty search state missing:\n%s", body)
118 118 }
119 if code, _ := f.get("/r/" + f.repo + "/search?q=needle&ref=nope"); code != 200 {
119 if code, _ := f.get("/" + f.repo + "/search?q=needle&ref=nope"); code != 200 {
120 120 t.Fatalf("unknown ref = %d, want an empty search page", code)
121 121 }
122 122 }
@@ -154,10 +154,10 @@ func TestHomeFeedMergesVisibleRepositories(t *testing.T) {
154 154 }
155 155
156 156 _, body := f.get("/")
157 if !strings.Contains(body, "Public issue marker") || !strings.Contains(body, `href="/r/demo"`) {
157 if !strings.Contains(body, "Public issue marker") || !strings.Contains(body, `href="/demo"`) {
158 158 t.Fatalf("home feed does not show the public repository:\n%s", body)
159 159 }
160 if strings.Contains(body, "Private issue marker") || strings.Contains(body, `href="/r/secret"`) {
160 if strings.Contains(body, "Private issue marker") || strings.Contains(body, `href="/secret"`) {
161 161 t.Fatalf("home feed leaked a private repository:\n%s", body)
162 162 }
163 163 }