Skip to content

Drop the CRLF conversion and cover the CRLF path with a fixture - #228

Draft
webdevred wants to merge 1 commit into
masterfrom
drop-crlf-conversion
Draft

Drop the CRLF conversion and cover the CRLF path with a fixture#228
webdevred wants to merge 1 commit into
masterfrom
drop-crlf-conversion

Conversation

@webdevred

Copy link
Copy Markdown
Owner

The release converted the shipped example files to CRLF. It is not worth keeping. The rulesets parse to the same thing either way, formatting a .jbeam file already keeps whatever line endings that file came with, and BeamNG is not consistent about it itself: 150 of the 4943 jbeam files in the stock vehicles are LF, so the game plainly reads them. The script had also drifted from what the packaging step copies, converting a directory that ships nowhere while leaving the rulesets that go into both the installer and the zip alone.

What the LF-only fixtures did cost is coverage. Nothing in the ordinary suite contained a carriage return, on a format whose real files are 97 per cent CRLF, and the parser has had a CRLF-specific bug in a block comment before. One fixture now carries CRLF deliberately, pinned as binary so no checkout normalises it away, and the spec asserts that the same file read both ways parses to the same tree. It also checks the fixture still has its carriage returns, so it cannot pass vacuously.

.gitattributes arrives with it, which the repository has never had. Until now the line endings in a working tree depended on each developer's core.autocrlf, which is the trap fixedPointSpec already carries a workaround for.

Still to come on this branch, which is why it is a draft: dump_ast detects the line endings of the file it is about to overwrite and writes them back. With the conversion gone it can drop that and always write LF, which also removes a writeFile whose text-mode translation would double the carriage returns on Windows.

Converting the shipped examples buys nothing measurable: the rulesets parse
identically either way, the tool already keeps the line endings a user's own
file came with, and BeamNG ships 150 LF files of 4943 itself. Meanwhile no
fixture had a carriage return in it, so the suite never exercised CRLF on a
format whose real files mostly are.
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