fix(patch): forcibly disable ANSI color codes when generating patch diff (#9914)

Add `--no-color` to pnpm's invocation of `git diff` within the patch-commit
command.  Ensures that the .diff files are valid when operating inside of
a git repository that has a local config that includes `diff.color=always`
This commit is contained in:
Andrew Schmadel
2025-09-13 12:44:38 -04:00
committed by GitHub
parent a3c1498403
commit c1540ea035
2 changed files with 7 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/plugin-commands-patching": patch
"pnpm": patch
---
Forcibly disable ANSI color codes when generating patch diff [#9914](https://github.com/pnpm/pnpm/pull/9914).

View File

@@ -151,7 +151,7 @@ async function diffFolders (folderA: string, folderB: string): Promise<string> {
let stderr!: string
try {
const result = await execa('git', ['-c', 'core.safecrlf=false', 'diff', '--src-prefix=a/', '--dst-prefix=b/', '--ignore-cr-at-eol', '--irreversible-delete', '--full-index', '--no-index', '--text', '--no-ext-diff', folderAN, folderBN], {
const result = await execa('git', ['-c', 'core.safecrlf=false', 'diff', '--src-prefix=a/', '--dst-prefix=b/', '--ignore-cr-at-eol', '--irreversible-delete', '--full-index', '--no-index', '--text', '--no-ext-diff', '--no-color', folderAN, folderBN], {
cwd: process.cwd(),
env: {
...process.env,