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/release_web_test.go +11−11
| @@ -16,7 +16,7 @@ func TestReleaseCreateAndEditFromTheBrowser(t *testing.T) { | |||
| 16 | 16 | } | |
| 17 | 17 | sess, cookie := f.browserSession(t, f.ownerID) | |
| 18 | 18 | ||
| 19 | resp, body := f.browserGet(t, "/r/"+f.repo+"/releases/new", cookie) | ||
| 19 | resp, body := f.browserGet(t, "/"+f.repo+"/releases/new", cookie) | ||
| 20 | 20 | if resp.StatusCode != 200 || !strings.Contains(body, "New release") { | |
| 21 | 21 | t.Fatalf("new release page = %d:\n%s", resp.StatusCode, body) | |
| 22 | 22 | } | |
| @@ -24,8 +24,8 @@ func TestReleaseCreateAndEditFromTheBrowser(t *testing.T) { | |||
| 24 | 24 | "csrf": {sess.CSRF}, "tag": {"v1.0.0"}, "target": {"main"}, | |
| 25 | 25 | "notes": {"## v1.0.0\n\nFirst release.\n"}, | |
| 26 | 26 | } | |
| 27 | resp, _ = f.browserPost(t, "/r/"+f.repo+"/releases", cookie, form) | ||
| 28 | if resp.StatusCode != 303 || resp.Header.Get("Location") != "/r/"+f.repo+"/releases/v1.0.0" { | ||
| 27 | resp, _ = f.browserPost(t, "/"+f.repo+"/releases", cookie, form) | ||
| 28 | if resp.StatusCode != 303 || resp.Header.Get("Location") != "/"+f.repo+"/releases/v1.0.0" { | ||
| 29 | 29 | t.Fatalf("create release = %d %q", resp.StatusCode, resp.Header.Get("Location")) | |
| 30 | 30 | } | |
| 31 | 31 | m, err := f.srv.Repos.Open(f.repo) | |
| @@ -39,17 +39,17 @@ func TestReleaseCreateAndEditFromTheBrowser(t *testing.T) { | |||
| 39 | 39 | if !tag.Annotated || !strings.Contains(tag.Message, "First release.") || tag.Tagger != "keenan" { | |
| 40 | 40 | t.Fatalf("created tag = %+v", tag) | |
| 41 | 41 | } | |
| 42 | resp, body = f.browserGet(t, "/r/"+f.repo+"/releases/v1.0.0", cookie) | ||
| 42 | resp, body = f.browserGet(t, "/"+f.repo+"/releases/v1.0.0", cookie) | ||
| 43 | 43 | if resp.StatusCode != 200 || !strings.Contains(body, "First release") || !strings.Contains(body, "Edit notes") { | |
| 44 | 44 | t.Fatalf("release page = %d:\n%s", resp.StatusCode, body) | |
| 45 | 45 | } | |
| 46 | 46 | ||
| 47 | resp, body = f.browserGet(t, "/r/"+f.repo+"/releases/edit?tag=v1.0.0", cookie) | ||
| 47 | resp, body = f.browserGet(t, "/"+f.repo+"/releases/edit?tag=v1.0.0", cookie) | ||
| 48 | 48 | if resp.StatusCode != 200 || !strings.Contains(body, "First release") { | |
| 49 | 49 | t.Fatalf("edit release page = %d:\n%s", resp.StatusCode, body) | |
| 50 | 50 | } | |
| 51 | 51 | form.Set("notes", "## v1.0.0\n\nRevised notes.\n") | |
| 52 | resp, _ = f.browserPost(t, "/r/"+f.repo+"/releases/edit", cookie, form) | ||
| 52 | resp, _ = f.browserPost(t, "/"+f.repo+"/releases/edit", cookie, form) | ||
| 53 | 53 | if resp.StatusCode != 303 { | |
| 54 | 54 | t.Fatalf("edit release = %d", resp.StatusCode) | |
| 55 | 55 | } | |
| @@ -63,16 +63,16 @@ func TestReleaseCreateAndEditFromTheBrowser(t *testing.T) { | |||
| 63 | 63 | ||
| 64 | 64 | form.Set("tag", "v1.0.0") | |
| 65 | 65 | form.Set("notes", "duplicate") | |
| 66 | if resp, body := f.browserPost(t, "/r/"+f.repo+"/releases", cookie, form); resp.StatusCode != 400 || !strings.Contains(body, "already exists") { | ||
| 66 | if resp, body := f.browserPost(t, "/"+f.repo+"/releases", cookie, form); resp.StatusCode != 400 || !strings.Contains(body, "already exists") { | ||
| 67 | 67 | t.Fatalf("duplicate release = %d:\n%s", resp.StatusCode, body) | |
| 68 | 68 | } | |
| 69 | 69 | form.Set("tag", "bad tag") | |
| 70 | if resp, _ := f.browserPost(t, "/r/"+f.repo+"/releases", cookie, form); resp.StatusCode != 400 { | ||
| 70 | if resp, _ := f.browserPost(t, "/"+f.repo+"/releases", cookie, form); resp.StatusCode != 400 { | ||
| 71 | 71 | t.Fatalf("invalid tag = %d, want 400", resp.StatusCode) | |
| 72 | 72 | } | |
| 73 | 73 | form.Set("tag", "v1.1.0") | |
| 74 | 74 | form.Set("notes", " ") | |
| 75 | if resp, body := f.browserPost(t, "/r/"+f.repo+"/releases", cookie, form); resp.StatusCode != 400 || !strings.Contains(body, "needs notes") { | ||
| 75 | if resp, body := f.browserPost(t, "/"+f.repo+"/releases", cookie, form); resp.StatusCode != 400 || !strings.Contains(body, "needs notes") { | ||
| 76 | 76 | t.Fatalf("empty notes = %d:\n%s", resp.StatusCode, body) | |
| 77 | 77 | } | |
| 78 | 78 | ||
| @@ -80,12 +80,12 @@ func TestReleaseCreateAndEditFromTheBrowser(t *testing.T) { | |||
| 80 | 80 | if err := m.Git().UpdateRef("refs/tags/light", commit); err != nil { | |
| 81 | 81 | t.Fatal(err) | |
| 82 | 82 | } | |
| 83 | if resp, body := f.browserGet(t, "/r/"+f.repo+"/releases/edit?tag=light", cookie); resp.StatusCode != 200 || !strings.Contains(body, "Lightweight tags have no notes") { | ||
| 83 | if resp, body := f.browserGet(t, "/"+f.repo+"/releases/edit?tag=light", cookie); resp.StatusCode != 200 || !strings.Contains(body, "Lightweight tags have no notes") { | ||
| 84 | 84 | t.Fatalf("lightweight edit page = %d:\n%s", resp.StatusCode, body) | |
| 85 | 85 | } | |
| 86 | 86 | form.Set("tag", "light") | |
| 87 | 87 | form.Set("notes", "cannot") | |
| 88 | if resp, _ := f.browserPost(t, "/r/"+f.repo+"/releases/edit", cookie, form); resp.StatusCode != 400 { | ||
| 88 | if resp, _ := f.browserPost(t, "/"+f.repo+"/releases/edit", cookie, form); resp.StatusCode != 400 { | ||
| 89 | 89 | t.Fatalf("lightweight edit = %d, want 400", resp.StatusCode) | |
| 90 | 90 | } | |
| 91 | 91 | } | |