Skip to content

Commit 2bb46f5

Browse files
saphidclaude
andcommitted
fix(server): generated commit and PR text no longer reads colored git output
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 30654b3 commit 2bb46f5

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2634,11 +2634,12 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
26342634
}),
26352635
);
26362636

2637-
it.effect("reads range patches from source without running textconv", () =>
2637+
it.effect("reads range patches from source without textconv or color", () =>
26382638
Effect.gen(function* () {
26392639
const cwd = yield* makeTmpDir();
26402640
const { initialBranch } = yield* initRepoWithCommit(cwd);
26412641
yield* git(cwd, ["config", "diff.probe.textconv", "touch textconv-ran; echo converted"]);
2642+
yield* git(cwd, ["config", "color.ui", "always"]);
26422643
yield* git(cwd, ["checkout", "-b", "feature/range"]);
26432644
yield* writeTextFile(cwd, ".gitattributes", "*.doc diff=probe\n");
26442645
yield* writeTextFile(cwd, "notes.doc", "source line\n");
@@ -2656,12 +2657,16 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
26562657
assert.include(context.diffPatch, "+plain line");
26572658
assert.include(context.diffPatch, "Binary files /dev/null and b/binary.dat differ");
26582659
assert.include(context.diffSummary, "notes.doc");
2660+
for (const output of [context.commitSummary, context.diffSummary, context.diffPatch]) {
2661+
assert.notInclude(output, "\u001b[");
2662+
}
26592663
assert.isFalse(yield* fileSystem.exists(`${cwd}/textconv-ran`));
26602664

26612665
yield* writeTextFile(cwd, "notes.doc", "updated source line\n");
26622666
const staged = yield* driver.prepareCommitContext(cwd, ["notes.doc"]);
26632667
assert.include(staged?.stagedPatch ?? "", "+updated source line");
26642668
assert.notInclude(staged?.stagedPatch ?? "", "converted");
2669+
assert.notInclude(staged?.stagedPatch ?? "", "\u001b[");
26652670
assert.include(staged?.stagedSummary ?? "", "notes.doc");
26662671
assert.isFalse(yield* fileSystem.exists(`${cwd}/textconv-ran`));
26672672
}),

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2529,7 +2529,15 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
25292529
const stagedPatch = yield* runGitStdoutWithOptions(
25302530
"GitVcsDriver.prepareCommitContext.stagedPatch",
25312531
cwd,
2532-
["diff", "--no-ext-diff", "--no-textconv", "--cached", "--patch", "--minimal"],
2532+
[
2533+
"diff",
2534+
"--no-color",
2535+
"--no-ext-diff",
2536+
"--no-textconv",
2537+
"--cached",
2538+
"--patch",
2539+
"--minimal",
2540+
],
25332541
{
25342542
env,
25352543
maxOutputBytes: PREPARED_COMMIT_PATCH_MAX_OUTPUT_BYTES,
@@ -2922,7 +2930,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
29222930
runGitStdoutWithOptions(
29232931
"GitVcsDriver.readRangeContext.log",
29242932
cwd,
2925-
["log", "--oneline", "--end-of-options", commitRange],
2933+
["log", "--oneline", "--no-color", "--end-of-options", commitRange],
29262934
{
29272935
maxOutputBytes: RANGE_COMMIT_SUMMARY_MAX_OUTPUT_BYTES,
29282936
appendTruncationMarker: true,
@@ -2931,7 +2939,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
29312939
runGitStdoutWithOptions(
29322940
"GitVcsDriver.readRangeContext.diffStat",
29332941
cwd,
2934-
["diff", "--stat", "--end-of-options", diffRange],
2942+
["diff", "--stat", "--no-color", "--end-of-options", diffRange],
29352943
{
29362944
maxOutputBytes: RANGE_DIFF_SUMMARY_MAX_OUTPUT_BYTES,
29372945
appendTruncationMarker: true,
@@ -2942,6 +2950,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
29422950
cwd,
29432951
[
29442952
"diff",
2953+
"--no-color",
29452954
"--no-ext-diff",
29462955
"--no-textconv",
29472956
"--patch",

0 commit comments

Comments
 (0)