Skip to content
TypeScript

fix(server): generated commit messages use source patches (#23164)

Victor Vogel067130517833
diff --git a/apps/server/src/vcs/GitVcsDriverCore.test.ts b/apps/server/src/vcs/GitVcsDriverCore.test.ts
index a89863d4f7f..404842ada91 100644
--- a/apps/server/src/vcs/GitVcsDriverCore.test.ts
+++ b/apps/server/src/vcs/GitVcsDriverCore.test.ts
@@ -4810,6 +4810,29 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
});
describe("commit context", () => {
+ it.effect("prepares source patches without running textconv", () =>
+ Effect.gen(function* () {
+ const cwd = yield* makeTmpDir();
+ yield* initRepoWithCommit(cwd);
+ yield* git(cwd, ["config", "diff.probe.textconv", "touch textconv-ran; echo converted"]);
+ yield* writeTextFile(cwd, ".gitattributes", "*.doc diff=probe\n");
+ yield* writeTextFile(cwd, "notes.doc", "original source\n");
+ yield* git(cwd, ["add", "."]);
+ yield* git(cwd, ["commit", "-m", "source document"]);
+ yield* writeTextFile(cwd, "notes.doc", "updated source\n");
+ const driver = yield* GitVcsDriver.GitVcsDriver;
+ const fileSystem = yield* FileSystem.FileSystem;
+
+ const context = yield* driver.prepareCommitContext(cwd, ["notes.doc"]);
+
+ assert.include(context?.stagedPatch ?? "", "-original source");
+ assert.include(context?.stagedPatch ?? "", "+updated source");
+ assert.notInclude(context?.stagedPatch ?? "", "converted");
+ assert.include(context?.stagedSummary ?? "", "notes.doc");
+ assert.isFalse(yield* fileSystem.exists(`${cwd}/textconv-ran`));
+ }),
+ );
+
it.effect("can omit the patch while preserving change detection and the real index", () =>
Effect.gen(function* () {
const cwd = yield* makeTmpDir();