Commit c074c8aa48

c074c8aa4896cf328001dc7ef83eccac2147c6c4

parent: 478bd0c00c

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-12 05:06 UTC

control, web: the close event reads closed by <who> in commit <sha>

Ref #182
e2e/commitrefs_test.go +7 −6
@@ -41,7 +41,7 @@ func TestCommitMessageIssueActions(t *testing.T) {
4141 mustGit(t, dir, env, "push", "-q", "origin", "main")
4242
4343 out, _, _ := inst.ssh(t, aliceKey, "", "issue", "show", "alice/app", "1", "--json")
44 if !strings.Contains(out, `"state":"closed"`) || !strings.Contains(out, "closed by commit") {
44 if !strings.Contains(out, `"state":"closed"`) || !strings.Contains(out, "closed by ") {
4545 t.Fatalf("issue 1 not closed by commit: %s", out)
4646 }
4747 // The entry is a system message with a linked sha, not a user comment.
@@ -86,15 +86,15 @@ func TestCommitMessageIssueActions(t *testing.T) {
8686 t.Fatalf("merge: %s", errOut)
8787 }
8888 out, _, _ = inst.ssh(t, aliceKey, "", "issue", "show", "alice/app", "3", "--json")
89 if !strings.Contains(out, `"state":"closed"`) || !strings.Contains(out, "closed by commit") {
89 if !strings.Contains(out, `"state":"closed"`) || !strings.Contains(out, "closed by ") {
9090 t.Fatalf("merge did not close issue 3: %s", out)
9191 }
9292 // This one was authored by an address nobody has verified, so it names
9393 // git's author without inventing a profile link for them.
94 if !strings.Contains(out, "by t:") || strings.Contains(out, "by [t]") {
94 if !strings.Contains(out, "closed by t in commit") || strings.Contains(out, "closed by [t]") {
9595 t.Fatalf("unresolved author should stay plain text: %s", out)
9696 }
97 if strings.Count(out, "closed by commit") != 1 {
97 if strings.Count(out, "closed by ") != 1 {
9898 t.Fatalf("duplicate close comments: %s", out)
9999 }
100100
@@ -126,8 +126,9 @@ func TestCommitMessageIssueActions(t *testing.T) {
126126 t.Fatalf("commit-file: %s", errOut)
127127 }
128128 out, _, _ = inst.ssh(t, aliceKey, "", "issue", "show", "alice/app", "2", "--json")
129 if !strings.Contains(out, `"state":"closed"`) || !strings.Contains(out, "closed by commit") ||
130 !strings.Contains(out, "by [alice](/alice): Closes #2 from the editor") {
129 if !strings.Contains(out, `"state":"closed"`) ||
130 !strings.Contains(out, "closed by [alice](/alice) in commit") ||
131 !strings.Contains(out, ": Closes #2 from the editor") {
131132 t.Fatalf("commit-file did not close issue 2: %s", out)
132133 }
133134 if strings.Count(out, "referenced in commit") != 1 {
internal/control/commitrefs.go +1 −1
@@ -240,7 +240,7 @@ func actOnIssue(st *store.Store, source, target store.Repo, actorID int64, sha s
240240 slog.Error("commit refs: closing issue", "issue", number, "err", err)
241241 return
242242 }
243 st.AddIssueSystemComment(issue.ID, actorID, fmt.Sprintf("closed by commit %s by %s: %s", link, author, subject))
243 st.AddIssueSystemComment(issue.ID, actorID, fmt.Sprintf("closed by %s in commit %s: %s", author, link, subject))
244244 st.RecordEvent(target.ID, actorID, "issue.closed", fmt.Sprintf(`{"number":%d,"sha":%q}`, number, sha))
245245 return
246246 }