Commit c074c8aa48
Verified · cmc
Layout: unified · split
e2e/commitrefs_test.go +7 −6
| @@ -41,7 +41,7 @@ func TestCommitMessageIssueActions(t *testing.T) { | ||
| 41 | 41 | mustGit(t, dir, env, "push", "-q", "origin", "main") |
| 42 | 42 | |
| 43 | 43 | 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 ") { | |
| 45 | 45 | t.Fatalf("issue 1 not closed by commit: %s", out) |
| 46 | 46 | } |
| 47 | 47 | // The entry is a system message with a linked sha, not a user comment. |
| @@ -86,15 +86,15 @@ func TestCommitMessageIssueActions(t *testing.T) { | ||
| 86 | 86 | t.Fatalf("merge: %s", errOut) |
| 87 | 87 | } |
| 88 | 88 | 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 ") { | |
| 90 | 90 | t.Fatalf("merge did not close issue 3: %s", out) |
| 91 | 91 | } |
| 92 | 92 | // This one was authored by an address nobody has verified, so it names |
| 93 | 93 | // 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]") { | |
| 95 | 95 | t.Fatalf("unresolved author should stay plain text: %s", out) |
| 96 | 96 | } |
| 97 | if strings.Count(out, "closed by commit") != 1 { | |
| 97 | if strings.Count(out, "closed by ") != 1 { | |
| 98 | 98 | t.Fatalf("duplicate close comments: %s", out) |
| 99 | 99 | } |
| 100 | 100 | |
| @@ -126,8 +126,9 @@ func TestCommitMessageIssueActions(t *testing.T) { | ||
| 126 | 126 | t.Fatalf("commit-file: %s", errOut) |
| 127 | 127 | } |
| 128 | 128 | 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") { | |
| 131 | 132 | t.Fatalf("commit-file did not close issue 2: %s", out) |
| 132 | 133 | } |
| 133 | 134 | 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 | ||
| 240 | 240 | slog.Error("commit refs: closing issue", "issue", number, "err", err) |
| 241 | 241 | return |
| 242 | 242 | } |
| 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)) | |
| 244 | 244 | st.RecordEvent(target.ID, actorID, "issue.closed", fmt.Sprintf(`{"number":%d,"sha":%q}`, number, sha)) |
| 245 | 245 | return |
| 246 | 246 | } |