Commit ba120a7365

ba120a7365b3c61f2785debcaedfb78c095fd144

parent: ddb7ee92e6

Verified · cmc ci/build: success ci/test: error

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

profile: the tests and the CLI table follow the about out of the flags

The profile form no longer previews, the about round-trip is a commit
into .gitbay, and the passthrough help no longer advertises --about,
--about-format or stdin.

Ref #236

Layout: unified · split

cmd/gitbay/main.go +4 −4
@@ -102,8 +102,8 @@ func newRoot() *cobra.Command {
102 orgCmd(), 102 orgCmd(),
103 group("profile", "user and org profiles", 103 group("profile", "user and org profiles",
104 pass("show", "show a profile: [name]", passOpts{server: []string{"profile", "show"}}), 104 pass("show", "show a profile: [name]", passOpts{server: []string{"profile", "show"}}),
105 pass("set", "set your profile: [--description d] [--website url] [--about t|--file -] [--about-format md|org] [--link label|url]...", 105 pass("set", "set your profile: [--description d] [--website url] [--link label|url]...",
106 passOpts{server: []string{"profile", "set"}, stdinOK: true}), 106 passOpts{server: []string{"profile", "set"}}),
107 ), 107 ),
108 webhookCmd(), 108 webhookCmd(),
109 remoteCmd(), 109 remoteCmd(),
@@ -671,8 +671,8 @@ func orgCmd() *cobra.Command {
671 pass("show", "show an organization and its members", passOpts{server: []string{"org", "show"}}), 671 pass("show", "show an organization and its members", passOpts{server: []string{"org", "show"}}),
672 pass("rename", "rename an organization: <old> <new>", passOpts{server: []string{"org", "rename"}}), 672 pass("rename", "rename an organization: <old> <new>", passOpts{server: []string{"org", "rename"}}),
673 pass("delete", "delete an empty organization (--yes)", passOpts{server: []string{"org", "delete"}}), 673 pass("delete", "delete an empty organization (--yes)", passOpts{server: []string{"org", "delete"}}),
674 pass("profile", "show or set an org profile: <org> [--description d] [--website url] [--about t|--file -] [--about-format md|org] [--link label|url]...", 674 pass("profile", "show or set an org profile: <org> [--description d] [--website url] [--link label|url]...",
675 passOpts{server: []string{"org", "profile"}, stdinOK: true}), 675 passOpts{server: []string{"org", "profile"}}),
676 group("members", "manage members", 676 group("members", "manage members",
677 pass("add", "add or update a member: <org> <user> [--role member|admin]", passOpts{server: []string{"org", "members", "add"}}), 677 pass("add", "add or update a member: <org> <user> [--role member|admin]", passOpts{server: []string{"org", "members", "add"}}),
678 pass("remove", "remove a member: <org> <user>", passOpts{server: []string{"org", "members", "remove"}}), 678 pass("remove", "remove a member: <org> <user>", passOpts{server: []string{"org", "members", "remove"}}),
e2e/previewweb_test.go +4 −8
@@ -137,14 +137,10 @@ func TestMarkupPreviewWeb(t *testing.T) {
137 }) 137 })
138 previewed("release edit", b, "<h2", "## release notes") 138 previewed("release edit", b, "<h2", "## release notes")
139 139
140 // The profile's about text. 140 // The profile form takes no markup: the about text is a file, and the
141 b = post(inst.base()+"/settings", url.Values{ 141 // file editor below is what previews it.
142 "field": {"profile"}, "about": {"# about me"}, "format": {"md"}, 142 if _, body := browserGet(t, alice, inst.base()+"/settings"); strings.Contains(body, `name="preview"`) {
143 "description": {"kept"}, "preview": {"1"}, 143 t.Fatalf("the profile form offers a preview:\n%s", body)
144 })
145 previewed("profile about", b, "<h1", `value="kept"`)
146 if out, _, _ := inst.ssh(t, aliceKey, "", "profile", "show", "--json"); strings.Contains(out, "about me") {
147 t.Fatalf("preview saved the profile: %s", out)
148 } 144 }
149 145
150 // The file editor previews a rendered path and offers nothing on one 146 // The file editor previews a rendered path and offers nothing on one
e2e/profile_test.go +25 −28
@@ -11,7 +11,9 @@ func TestOwnerProfiles(t *testing.T) {
11 inst := startInstance(t) 11 inst := startInstance(t)
12 aliceKey := inst.newKey(t, "alice") 12 aliceKey := inst.newKey(t, "alice")
13 bobKey := inst.newKey(t, "bob") 13 bobKey := inst.newKey(t, "bob")
14 inst.admin(t, "admin", "user", "create", "alice", "--key", aliceKey+".pub") 14 // A verified address, because the about text is a commit now.
15 inst.admin(t, "admin", "user", "create", "alice",
16 "--key", aliceKey+".pub", "--email", "alice@example.test", "--verified")
15 inst.admin(t, "admin", "user", "create", "bob", "--key", bobKey+".pub") 17 inst.admin(t, "admin", "user", "create", "bob", "--key", bobKey+".pub")
16 18
17 // Self-service user profile; website validated. 19 // Self-service user profile; website validated.
@@ -136,30 +138,22 @@ func TestOwnerProfiles(t *testing.T) {
136 t.Fatalf("org profile show: %s", out) 138 t.Fatalf("org profile show: %s", out)
137 } 139 }
138 140
139 // About: long-form markdown, set inline or piped, rendered on the page. 141 // About: a file in <owner>/.gitbay, rendered on the page. The
140 if _, errOut, code := inst.ssh(t, aliceKey, "# Hello\n\nI maintain *small tools*.\n", 142 // extension picks the renderer; there is no stored format.
141 "profile", "set", "--file", "-"); code != 0 { 143 if _, errOut, code := inst.ssh(t, aliceKey, "", "repo", "create", "alice/.gitbay"); code != 0 {
142 t.Fatalf("about from stdin: %s", errOut) 144 t.Fatalf("creating alice/.gitbay: %s", errOut)
143 }
144 out, _, _ = inst.ssh(t, aliceKey, "", "profile", "show", "alice", "--json")
145 if !strings.Contains(out, "I maintain *small tools*.") {
146 t.Fatalf("about not stored: %s", out)
147 } 145 }
148 if !strings.Contains(out, "tinkerer") {
149 t.Fatalf("about clobbered the description: %s", out)
150 }
151
152 // Org-mode about: the stored format picks the renderer.
153 if _, errOut, code := inst.ssh(t, aliceKey, "* Tools\n\nI maintain /small tools/.\n", 146 if _, errOut, code := inst.ssh(t, aliceKey, "* Tools\n\nI maintain /small tools/.\n",
154 "profile", "set", "--file", "-", "--about-format", "org"); code != 0 { 147 "repo", "commit-file", "alice/.gitbay", "profile/README.org",
148 "--ref", "main", "--file", "-"); code != 0 {
155 t.Fatalf("org about: %s", errOut) 149 t.Fatalf("org about: %s", errOut)
156 } 150 }
157 out, _, _ = inst.ssh(t, aliceKey, "", "profile", "show", "alice", "--json") 151 out, _, _ = inst.ssh(t, aliceKey, "", "profile", "show", "alice", "--json")
158 if !strings.Contains(out, `"about_format":"org"`) { 152 if !strings.Contains(out, `"about_format":"org"`) {
159 t.Fatalf("about format not stored: %s", out) 153 t.Fatalf("about format not read from the extension: %s", out)
160 } 154 }
161 if _, _, code := inst.ssh(t, aliceKey, "", "profile", "set", "--about-format", "rst"); code != 2 { 155 if !strings.Contains(out, "tinkerer") {
162 t.Fatal("unknown about format accepted") 156 t.Fatalf("about clobbered the description: %s", out)
163 } 157 }
164 // Org emphasis parsed, not left as literal slashes the way the 158 // Org emphasis parsed, not left as literal slashes the way the
165 // markdown renderer would. 159 // markdown renderer would.
@@ -168,10 +162,15 @@ func TestOwnerProfiles(t *testing.T) {
168 t.Fatalf("org about not rendered as org: %s", body) 162 t.Fatalf("org about not rendered as org: %s", body)
169 } 163 }
170 164
171 // Back to markdown for the rest of the checks. 165 // Markdown for the rest of the checks: .md wins the resolution order.
172 if _, _, code := inst.ssh(t, aliceKey, "# Hello\n\nI maintain *small tools*.\n", 166 if _, errOut, code := inst.ssh(t, aliceKey, "# Hello\n\nI maintain *small tools*.\n",
173 "profile", "set", "--file", "-", "--about-format", "md"); code != 0 { 167 "repo", "commit-file", "alice/.gitbay", "profile/README.md",
174 t.Fatal("markdown about") 168 "--ref", "main", "--file", "-"); code != 0 {
169 t.Fatalf("markdown about: %s", errOut)
170 }
171 out, _, _ = inst.ssh(t, aliceKey, "", "profile", "show", "alice", "--json")
172 if !strings.Contains(out, "I maintain *small tools*.") {
173 t.Fatalf("about not read from the repository: %s", out)
175 } 174 }
176 175
177 // Links: free-form, labelled or bare, capped, cleared by an empty one. 176 // Links: free-form, labelled or bare, capped, cleared by an empty one.
@@ -218,16 +217,14 @@ func TestOwnerProfiles(t *testing.T) {
218 t.Error("repositories render above the activity graph") 217 t.Error("repositories render above the activity graph")
219 } 218 }
220 219
221 // Clearing works the same way as the other fields. 220 // Clearing works the same way as the other fields. The about is not
221 // among them: it is a file, and it goes the way a file goes.
222 if _, _, code := inst.ssh(t, aliceKey, "", "profile", "set", "--link", "''"); code != 0 { 222 if _, _, code := inst.ssh(t, aliceKey, "", "profile", "set", "--link", "''"); code != 0 {
223 t.Fatal("clear links failed") 223 t.Fatal("clear links failed")
224 } 224 }
225 if _, _, code := inst.ssh(t, aliceKey, "", "profile", "set", "--about", "''"); code != 0 {
226 t.Fatal("clear about failed")
227 }
228 out, _, _ = inst.ssh(t, aliceKey, "", "profile", "show", "alice", "--json") 225 out, _, _ = inst.ssh(t, aliceKey, "", "profile", "show", "alice", "--json")
229 if strings.Contains(out, "fosstodon") || strings.Contains(out, "small tools") { 226 if strings.Contains(out, "fosstodon") {
230 t.Fatalf("about or links not cleared: %s", out) 227 t.Fatalf("links not cleared: %s", out)
231 } 228 }
232 status, body = inst.get(t, "/workshop") 229 status, body = inst.get(t, "/workshop")
233 if status != 200 || !strings.Contains(body, "where things get made") || 230 if status != 200 || !strings.Contains(body, "where things get made") ||