{{ message }}
Repository navigation
ci: check every text file out as LF so the Windows test leg sees the same bytes - #5447
Merged
Merged
Conversation
#5323 added a `windows-latest` leg to the unit-test matrix. GitHub's Windows runner images set `core.autocrlf=true` globally and the repo declares no attributes, so from now on the two legs test different bytes: every text file arrives LF on Linux and CRLF on Windows. Several specs read tracked source files and parse them as text — source-code-image-action.spec.ts and search-prefill.spec.ts compile a .vue and split its output on '\n', empty-state-button-contrast.spec.ts regex-matches the components' scoped CSS. They pass today only because those patterns happen to tolerate a trailing '\r'. An `m`-flagged `$`, a `toBe` on a split line, or any assertion holding a literal '\n' would fail on Windows alone, and the cause is invisible in a diff: test/unit/markdown.ts already carries an explicit `.replace(/(?:\r\n|\n)/g, '\n')` from the last time this bit someone. `* text=auto eol=lf` normalizes on commit and checks out LF everywhere, which also keeps a Windows contributor's working tree from turning a whole file into a diff. There are no .bat/.cmd/.ps1 files needing CRLF; the one NSIS include, packages/desktop/build/windows/installer.nsh, reads LF fine. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`* text=auto eol=lf` normalizes on add, so the two blobs that were committed with CRLF no longer match what git would now store for the same working-tree content. Left alone they surface as spurious modifications the first time git compares them by content rather than by stat cache. Both are vendored Open Sans licence texts and the change is CR-at-EOL only: `git diff --ignore-cr-at-eol` between the two revisions is empty. Kept separate from the attribute itself, as git's own documentation advises, so the one-line policy change stays reviewable next to 808 lines of mechanical churn. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Contributor
|
Build artifacts for PR #5447: Run: https://github.com/marktext/marktext/actions/runs/35335973618 |
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.

Summary
Follow-up to #5323, which added a
windows-latestleg to the unit-test matrix.GitHub's Windows runner images set
core.autocrlf=trueglobally, and this repo declares no attributes of its own. So as of that PR the two matrix legs no longer test the same bytes: every text file is checked out LF onubuntu-latestand CRLF onwindows-latest.That matters because several specs read tracked source files and parse them as text:
source-code-image-action.spec.tsandsearch-prefill.spec.tsread a.vue, compile it, then.split('\n')the output to strip import lines;empty-state-button-contrast.spec.tsregex-matches the components' scoped CSS and the theme stylesheets to pull custom-property names.They pass on Windows today only because those particular patterns happen to tolerate a trailing
\r. The next assertion that doesn't — anm-flagged$(which will not match before a\r\n), atoBeon a split line, a snippet holding a literal\n, a snapshot — goes red on Windows alone, and the cause is invisible in a diff and unreproducible on macOS or Linux.test/unit/markdown.ts:8already carries an explicit.replace(/(?:\r\n|\n)/g, '\n'), so this has cost someone time before; that fix was local to one helper and left the class open.* text=auto eol=lfnormalizes on commit and checks out LF on every platform, closing the class in one line. It also keeps a Windows contributor's editor from turning a whole file into a diff on save.No file in the tree needs CRLF: there are no
.bat,.cmdor.ps1files, and the single NSIS include (packages/desktop/build/windows/installer.nsh) reads LF fine.Commits
ci: check every text file out as LF on all platforms— adds.gitattributes.ci: renormalize the two files stored with CRLF— the two vendored Open Sans licence texts were committed with CRLF, so their blobs no longer match what git would store for the same working-tree content; left alone they surface as spurious modifications the first time git compares by content rather than by stat cache. Kept as its own commit, as git's documentation advises, so the one-line policy change stays reviewable next to 808 lines of mechanical churn.Type of change
Notes for reviewers
The renormalization is line-endings only —
git diff --ignore-cr-at-eolacross the two commits is empty. After it, no blob in the tree contains a CR at end of line (git grep --cached -lIP "\r$"returns nothing) and the working tree is clean.🤖 Generated with Claude Code