Skip to content

Commit 50106ef

Browse files
saphidclaude
andauthored
fix(server): generated commit and PR text no longer reads colored git output (pingdotgg#29126)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 5815442 commit 50106ef

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
@@ -2714,11 +2714,12 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
27142714
}),
27152715
);
27162716

2717-
it.effect("reads range patches from source without running textconv", () =>
2717+
it.effect("reads range patches from source without textconv or color", () =>
27182718
Effect.gen(function* () {
27192719
const cwd = yield* makeTmpDir();
27202720
const { initialBranch } = yield* initRepoWithCommit(cwd);
27212721
yield* git(cwd, ["config", "diff.probe.textconv", "touch textconv-ran; echo converted"]);
2722+
yield* git(cwd, ["config", "color.ui", "always"]);
27222723
yield* git(cwd, ["checkout", "-b", "feature/range"]);
27232724
yield* writeTextFile(cwd, ".gitattributes", "*.doc diff=probe\n");
27242725
yield* writeTextFile(cwd, "notes.doc", "source line\n");
@@ -2736,12 +2737,16 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
27362737
assert.include(context.diffPatch, "+plain line");
27372738
assert.include(context.diffPatch, "Binary files /dev/null and b/binary.dat differ");
27382739
assert.include(context.diffSummary, "notes.doc");
2740+
for (const output of [context.commitSummary, context.diffSummary, context.diffPatch]) {
2741+
assert.notInclude(output, "\u001b[");
2742+
}
27392743
assert.isFalse(yield* fileSystem.exists(`${cwd}/textconv-ran`));
27402744

27412745
yield* writeTextFile(cwd, "notes.doc", "updated source line\n");
27422746
const staged = yield* driver.prepareCommitContext(cwd, ["notes.doc"]);
27432747
assert.include(staged?.stagedPatch ?? "", "+updated source line");
27442748
assert.notInclude(staged?.stagedPatch ?? "", "converted");
2749+
assert.notInclude(staged?.stagedPatch ?? "", "\u001b[");
27452750
assert.include(staged?.stagedSummary ?? "", "notes.doc");
27462751
assert.isFalse(yield* fileSystem.exists(`${cwd}/textconv-ran`));
27472752
}),

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,7 +2530,15 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
25302530
const stagedPatch = yield* runGitStdoutWithOptions(
25312531
"GitVcsDriver.prepareCommitContext.stagedPatch",
25322532
cwd,
2533-
["diff", "--no-ext-diff", "--no-textconv", "--cached", "--patch", "--minimal"],
2533+
[
2534+
"diff",
2535+
"--no-color",
2536+
"--no-ext-diff",
2537+
"--no-textconv",
2538+
"--cached",
2539+
"--patch",
2540+
"--minimal",
2541+
],
25342542
{
25352543
env,
25362544
maxOutputBytes: PREPARED_COMMIT_PATCH_MAX_OUTPUT_BYTES,
@@ -2923,7 +2931,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
29232931
runGitStdoutWithOptions(
29242932
"GitVcsDriver.readRangeContext.log",
29252933
cwd,
2926-
["log", "--oneline", "--end-of-options", commitRange],
2934+
["log", "--oneline", "--no-color", "--end-of-options", commitRange],
29272935
{
29282936
maxOutputBytes: RANGE_COMMIT_SUMMARY_MAX_OUTPUT_BYTES,
29292937
appendTruncationMarker: true,
@@ -2932,7 +2940,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
29322940
runGitStdoutWithOptions(
29332941
"GitVcsDriver.readRangeContext.diffStat",
29342942
cwd,
2935-
["diff", "--stat", "--end-of-options", diffRange],
2943+
["diff", "--stat", "--no-color", "--end-of-options", diffRange],
29362944
{
29372945
maxOutputBytes: RANGE_DIFF_SUMMARY_MAX_OUTPUT_BYTES,
29382946
appendTruncationMarker: true,
@@ -2943,6 +2951,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
29432951
cwd,
29442952
[
29452953
"diff",
2954+
"--no-color",
29462955
"--no-ext-diff",
29472956
"--no-textconv",
29482957
"--patch",

0 commit comments

Comments
 (0)