Skip to content

all: check out testdata with LF line endings on all platforms - #5872

Merged
davecheney merged 1 commit into
tinygo-org:devfrom
davecheney:dfc/gitattributes-testdata-lf
Oct 13, 2026
Merged

davecheney merged 1 commit into
tinygo-org:devfrom
davecheney:dfc/gitattributes-testdata-lf

Conversation

@davecheney

@davecheney davecheney commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Git for Windows sets core.autocrlf=true by default, and the repository has no .gitattributes file. On Windows, Git therefore checks out all text files with CRLF line endings. Many tests read testdata files byte for byte, so each test that reads a fixture had its own workaround to remove the '\r' characters. A new test that does not do this passes on Linux and macOS and fails only on Windows CI.

Add a .gitattributes file that checks out all files under testdata directories with LF line endings, and remove the workarounds that this makes unnecessary.

Keep the '\r' handling for program output. Baremetal targets write CRLF line endings, so the output of a program can contain '\r' on all platforms. Keep the '\r' handling in the builder, which reads output from tools on Windows.


Windows contributors with an existing checkout: run git rm -r --cached -q . && git reset --hard once after you pull this, or tests will fail.

Git for Windows sets core.autocrlf=true by default, and the repository has no .gitattributes file. On Windows, Git therefore checks out all text files with CRLF line endings. Many tests read testdata files byte for byte, so each test that reads a fixture had its own workaround to remove the '\r' characters. A new test that does not do this passes on Linux and macOS and fails only on Windows CI.

Add a .gitattributes file that checks out all files under testdata directories with LF line endings, and remove the workarounds that this makes unnecessary.

Keep the '\r' handling for program output. Baremetal targets write CRLF line endings, so the output of a program can contain '\r' on all platforms. Keep the '\r' handling in the builder, which reads output from tools on Windows.
@davecheney

Copy link
Copy Markdown
Contributor Author

@deadprogram this pays down the pile of line ending workarounds that #5837 was the most recent abuser of.

@dgryski dgryski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Windows tests pass.

@davecheney
davecheney merged commit e830305 into tinygo-org:dev Oct 13, 2026
33 checks passed
@davecheney
davecheney deleted the dfc/gitattributes-testdata-lf branch October 13, 2026 21:58
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.

2 participants