Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix snapshots and tests line-ending in Windows #2166

Merged
merged 1 commit into from
Nov 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
crates/ra_syntax/tests/data/** -text
crates/ra_syntax/test_data/** -text eof=LF
crates/ra_ide_api/src/snapshots/** -text eof=LF
Comment on lines -1 to +2
Copy link
Member

Choose a reason for hiding this comment

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

There's no way this could have worked, if you read the documentation:

  • eof doesn't exist, eol does
  • eol only works on text files
    • this makes sense, since it's lossy in general, and only text files can accept the lossiness as "CRLF and LF are two ways to represent the same thing" (line endings

If the goal here was to hide files from git grep, I'm afraid there is no way to do that without leaving the door open to CRLF (\r\n) corruption.

Honestly looking at #1115 I have no idea what's going on. Most likely some buggy tool produced \r\n instead of \n for line endings, which didn't match the correct (\n) ones git was dutifully using.

If it's the other way around, then the autocrlf setting is being set to the cursed option that generates \r\n on the fly from files committed as \n (which is not something you should never need or use - only outdated stuff like notepad.exe needs it).

Copy link
Member

Choose a reason for hiding this comment

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

only outdated stuff like notepad.exe needs it

Even Notepad supports Unix line endings now: https://www.theregister.com/2018/05/08/windows_notepad_unix_linux_macos/.