)}
{checkProblems.length > 0 && (
diff --git a/src/features/vcs/__tests__/workflow.test.ts b/src/features/vcs/__tests__/workflow.test.ts
index c0b3ceb55..0a0be5f62 100644
--- a/src/features/vcs/__tests__/workflow.test.ts
+++ b/src/features/vcs/__tests__/workflow.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { BranchInfo } from "@/bindings";
-import { messageProblems, wrapAtMargin } from "../CommitView";
+import { addBlankLineAfterSubject, messageProblems, wrapAtMargin } from "../CommitView";
import { linkifyIssues } from "../issueLinks";
import {
isProtectedBranch,
@@ -41,6 +41,14 @@ describe("commit message inspections", () => {
expect(messageProblems("x".repeat(20), { ...cfg, limitSubject: false })).toEqual([]);
});
+ it("adds the missing blank line after the subject", () => {
+ const fixed = addBlankLineAfterSubject("111\n111");
+ expect(fixed).toBe("111\n\n111");
+ expect(messageProblems(fixed, cfg)).toEqual([]);
+ expect(addBlankLineAfterSubject("subject\nline 2\nline 3")).toBe("subject\n\nline 2\nline 3");
+ expect(addBlankLineAfterSubject("subject")).toBe("subject");
+ });
+
it("wraps body lines at the last space before the margin", () => {
const text = "subject\n\nhello world again";
expect(wrapAtMargin(text, text.length, 12)).toEqual({ text: "subject\n\nhello world\nagain", caret: text.length });
diff --git a/src/platform/locales/text/en.json b/src/platform/locales/text/en.json
index 4edfce68a..f3969ce08 100644
--- a/src/platform/locales/text/en.json
+++ b/src/platform/locales/text/en.json
@@ -2158,5 +2158,8 @@
"The interface could not be extracted": "The interface could not be extracted",
"Extract Interface is not supported for {name}": "Extract Interface is not supported for {name}",
"Package for new interface": "Package for new interface",
- "Untitled files were not saved": "Untitled files were not saved"
+ "Untitled files were not saved": "Untitled files were not saved",
+ "Missing blank line between subject and body": "Missing blank line between subject and body",
+ "Body line {0} is longer than {1} characters": "Body line {0} is longer than {1} characters",
+ "Add blank line": "Add blank line"
}
diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json
index 584c3655b..52dd7ac9c 100644
--- a/src/platform/locales/text/zh.json
+++ b/src/platform/locales/text/zh.json
@@ -8541,5 +8541,8 @@
"The interface could not be extracted": "无法提取接口",
"Extract Interface is not supported for {name}": "{name} 不支持提取接口",
"Package for new interface": "新接口的软件包",
- "Untitled files were not saved": "未命名文件未保存"
+ "Untitled files were not saved": "未命名文件未保存",
+ "Missing blank line between subject and body": "主题和正文之间缺少空行",
+ "Body line {0} is longer than {1} characters": "正文第 {0} 行超过 {1} 个字符",
+ "Add blank line": "添加空行"
}