Commit 925e46b053

925e46b053ae9f32f28d5d35100c5db83cb91823

parent: ca412c06a9

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-20 00:14 UTC

explore, profile: dot-repos stay out of the listings

Ref #236
e2e/profileabout_test.go +37
@@ -101,6 +101,43 @@ func TestProfileAboutFormatAndPrivacy(t *testing.T) {
101101 }
102102}
103103
104// A dot-repo is infrastructure: it stays out of explore and off the
105// profile's repository list, and stays in the owner's own inventory.
106func TestDotReposHiddenFromListings(t *testing.T) {
107 inst := startInstance(t)
108 aliceKey := inst.newKey(t, "alice")
109 inst.admin(t, "admin", "user", "create", "alice",
110 "--key", aliceKey+".pub", "--email", "alice@example.test", "--verified")
111 inst.ssh(t, aliceKey, "", "repo", "create", "alice/.gitbay")
112 inst.ssh(t, aliceKey, "", "repo", "create", "alice/app")
113
114 out, _, _ := inst.ssh(t, aliceKey, "", "explore", "--json")
115 if strings.Contains(out, ".gitbay") {
116 t.Errorf("dot-repo listed in explore: %s", out)
117 }
118 if !strings.Contains(out, "alice/app") {
119 t.Errorf("ordinary repo missing from explore: %s", out)
120 }
121
122 out, _, _ = inst.ssh(t, aliceKey, "", "profile", "show", "alice", "--json")
123 if strings.Contains(out, `"path":"alice/.gitbay"`) {
124 t.Errorf("dot-repo listed on the profile: %s", out)
125 }
126 if !strings.Contains(out, `"path":"alice/app"`) {
127 t.Errorf("ordinary repo missing from the profile: %s", out)
128 }
129
130 out, _, _ = inst.ssh(t, aliceKey, "", "repo", "list", "--json")
131 if !strings.Contains(out, "alice/.gitbay") {
132 t.Errorf("dot-repo missing from the owner's own inventory: %s", out)
133 }
134
135 // It is still reachable at its URL.
136 if _, page := inst.get(t, "/alice/.gitbay"); strings.Contains(page, "not found") {
137 t.Error("dot-repo page not reachable")
138 }
139}
140
104141// The about is not settable through profile set any more: it is a file.
105142func TestProfileSetHasNoAbout(t *testing.T) {
106143 inst := startInstance(t)
internal/control/explore.go +6
@@ -3,6 +3,7 @@ package control
33import (
44 "fmt"
55 "io"
6 "strings"
67
78 "gitbay.org/gitbay/internal/gitutil"
89 "gitbay.org/gitbay/internal/policy"
@@ -53,6 +54,11 @@ func runExplore(c *Ctx, args []string) int {
5354 }
5455 var ds []out
5556 for _, repo := range repos {
57 // A dot-repo is infrastructure, not a project: .gitbay holds an
58 // owner's profile content and has nothing to explore.
59 if strings.HasPrefix(repo.Name, ".") {
60 continue
61 }
5662 if p.key != "" && repo.Path() <= p.key {
5763 continue
5864 }
internal/control/profile.go +5
@@ -320,6 +320,11 @@ func runProfileShow(c *Ctx, args []string) int {
320320 return c.fail(protocol.ExitFailure, "%v", err)
321321 }
322322 for _, repo := range all {
323 // A dot-repo is infrastructure, not a project: .gitbay holds this
324 // profile's about text and does not belong in its listing.
325 if strings.HasPrefix(repo.Name, ".") {
326 continue
327 }
323328 grant, err := c.Store.AccessRole(repo.ID, c.User.ID)
324329 if err != nil {
325330 return c.fail(protocol.ExitFailure, "%v", err)