Skip to content

Commit 0671305

Browse files
only21milcodexmaria-rcks
authored
fix(server): generated commit messages use source patches (#23164)
Co-authored-by: GPT-6.1 Sol <[email protected]> Co-authored-by: maria-rcks <[email protected]>
1 parent bc799c4 commit 0671305

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4810,6 +4810,29 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
48104810
});
48114811

48124812
describe("commit context", () => {
4813+
it.effect("prepares source patches without running textconv", () =>
4814+
Effect.gen(function* () {
4815+
const cwd = yield* makeTmpDir();
4816+
yield* initRepoWithCommit(cwd);
4817+
yield* git(cwd, ["config", "diff.probe.textconv", "touch textconv-ran; echo converted"]);
4818+
yield* writeTextFile(cwd, ".gitattributes", "*.doc diff=probe\n");
4819+
yield* writeTextFile(cwd, "notes.doc", "original source\n");
4820+
yield* git(cwd, ["add", "."]);
4821+
yield* git(cwd, ["commit", "-m", "source document"]);
4822+
yield* writeTextFile(cwd, "notes.doc", "updated source\n");
4823+
const driver = yield* GitVcsDriver.GitVcsDriver;
4824+
const fileSystem = yield* FileSystem.FileSystem;
4825+
4826+
const context = yield* driver.prepareCommitContext(cwd, ["notes.doc"]);
4827+
4828+
assert.include(context?.stagedPatch ?? "", "-original source");
4829+
assert.include(context?.stagedPatch ?? "", "+updated source");
4830+
assert.notInclude(context?.stagedPatch ?? "", "converted");
4831+
assert.include(context?.stagedSummary ?? "", "notes.doc");
4832+
assert.isFalse(yield* fileSystem.exists(`${cwd}/textconv-ran`));
4833+
}),
4834+
);
4835+
48134836
it.effect("can omit the patch while preserving change detection and the real index", () =>
48144837
Effect.gen(function* () {
48154838
const cwd = yield* makeTmpDir();

0 commit comments

Comments
 (0)