fix(ci): force LF for diffview testdata fixtures on Windows#2932
Closed
johnjansen wants to merge 1 commit into
Closed
fix(ci): force LF for diffview testdata fixtures on Windows#2932johnjansen wants to merge 1 commit into
johnjansen wants to merge 1 commit into
Conversation
Contributor
Author
|
Closing as superseded / stale relative to v0.70.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows CI,
TestDiffViewWidth/Split/WidthOf082fails with a goldenmismatch: the closing
}renders red (#d20f39, the catppuccin-lattekeyword color) instead of grey (
#4c4f69, the text color). Example:https://github.com/charmbracelet/crush/actions/runs/25949037144/job/76283113121
Root cause
The test embeds Go-source fixtures via
go:embed:These
.before/.afterfiles have no entry in.gitattributes, so onWindows checkouts with the default
core.autocrlf=truethey getconverted to CRLF on disk. Chroma's Go lexer then sees
}\r\nat EOFand tokenizes the trailing brace inconsistently — at most widths the
renderer still picks the text color, but at width 82 the layout boundary
exposes a token that's been classified as a keyword.
Linux and macOS check out with LF, so the issue is invisible there. The
golden files are already protected via
*.golden ... -text, but thesource fixtures that feed chroma are not.
Fix
Pin the embedded fixtures to LF in
.gitattributes:This forces git to keep these files LF in the working tree on all
platforms, matching what's stored in the repo and what macOS / Linux
contributors already see.
Test plan
go test ./internal/ui/diffview/...passes locally on macOS(baseline — was already passing).
git check-attr eol internal/ui/diffview/testdata/*.beforereports
eol: lfafter the change.No code change, no behavior change on Linux/macOS, no golden
regeneration needed.
CONTRIBUTING.md.