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.
|
ed03b3d1
Keenan Nemetz
9h ago
|
1 | package repo |
| 2 | ||
| 3 | import ( | |
| 4 | "strings" | |
| 5 | "testing" | |
| 6 | ) | |
| 7 | ||
| 8 | // A repository owns the root of the URL space, so only the four names the forge | |
| 9 | // must serve at the root are unavailable. A name the forge would otherwise use | |
| 10 | // for a page ("admin", "u", "activity") is an ordinary repository. | |
| 11 | func TestValidateNameReservesOnlyTheForgeRoot(t *testing.T) { | |
| 12 | t.Parallel() | |
| 13 | for _, name := range []string{"demo", "admin", "u", "r", "activity", "login", "users", "vole-instance", "git"} { | |
| 14 | if err := ValidateName(name); err != nil { | |
| 15 | t.Errorf("ValidateName(%q) = %v, want it accepted", name, err) | |
| 16 | } | |
| 17 | } | |
| 18 | for name, want := range map[string]string{ | |
| 19 | "static": "/static/", | |
| 20 | "robots.txt": "/robots.txt", | |
| 21 | "sitemap.xml": "/sitemap.xml", | |
| 22 | "sitemap-pages.xml": "/sitemap-pages.xml", | |
| 23 | "demo.git": ".git", | |
| 24 | "Demo": "lowercase", | |
| 25 | "-demo": "lowercase letters", | |
| 26 | "a..b": "invalid repo name", | |
| 27 | } { | |
| 28 | err := ValidateName(name) | |
| 29 | if err == nil { | |
| 30 | t.Errorf("ValidateName(%q) was accepted", name) | |
| 31 | continue | |
| 32 | } | |
| 33 | if !strings.Contains(err.Error(), want) { | |
| 34 | t.Errorf("ValidateName(%q) = %q, want it to mention %q", name, err, want) | |
| 35 | } | |
| 36 | } | |
| 37 | } |