Skip to content

fix(git-service): sanitize git output#19

Open
jeffdetmer wants to merge 1 commit into
mcollina:mainfrom
jeffdetmer:support-ansi-colors-from-git
Open

fix(git-service): sanitize git output#19
jeffdetmer wants to merge 1 commit into
mcollina:mainfrom
jeffdetmer:support-ansi-colors-from-git

Conversation

@jeffdetmer
Copy link
Copy Markdown

@jeffdetmer jeffdetmer commented Mar 13, 2026

I was running into issues viewing the git diffs, the changes weren't showing and I couldn't create reviews.
I tracked it down to git sending ANSI colors and the parse expecting the git output to be plain text.

I added --no-color and --no-ext-diff flags to all of the git diff/show calls and removed any additional VT control characters and works for me now.

This should also possibly solve #15 (comment)

…diff output

Add --no-color and --no-ext-diff flags to all git diff/show calls via
centralized getPlainDiff() and getPlainShowDiff() helpers, and strip
any remaining VT control characters using Node's
stripVTControlCharacters. This prevents ANSI escape sequences from
leaking into diff responses when users have color.diff=always or
external diff tools configured.

Also improves error logging in getUnstagedDiff for unreadable untracked
files, and adds tests for getStagedDiff, getStagedFileDiff, and
getBranchDiff with terminal control character assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant