YamlDotNet icon indicating copy to clipboard operation
YamlDotNet copied to clipboard

Fix inconsistent line endings

Open DSchroer opened this issue 3 years ago • 2 comments
trafficstars

Update the line endings across the project to be consistent.

Motivation

Some tools complain when dealing with mixed line endings. The project currently has a mix of Windows \r\n and Unix style \n.

DSchroer avatar Sep 13 '22 18:09 DSchroer

I'm thinking a potentially better solution to this would be using .gitattributes to handle line endings. Maybe with the contents of something like this

*.sh EOL=lf
*.* EOL=crlf

I'm going off of memory here, so it may be incorrect values. But then, in theory, it'll be correct regardless of the platform (Linux aka Docker/Windows/etc) it is checked out on.

EdwardCooke avatar Sep 17 '22 20:09 EdwardCooke

Sure. Happy to add the adjusted gitattributes.

DSchroer avatar Sep 19 '22 13:09 DSchroer

This change broke the build - https://ci.appveyor.com/project/aaubry/yamldotnet/builds/44921032

You need to be very careful with line endings because Linux doesn't expect \r. Personally I would have preferred not touching the line endings as everything was working correctly.

aaubry avatar Sep 29 '22 13:09 aaubry

The the PR itself was building correctly - https://ci.appveyor.com/project/aaubry/yamldotnet/builds/44817924. So this is probably a merge error.

aaubry avatar Sep 29 '22 13:09 aaubry

The run.sh file hasn't been modified. I guess it's .gitattributes that is causing the problem. I'm not familiar with this file. I always configure git to never modify my line endings. @EdwardCooke do you have an idea of how to fix this?

aaubry avatar Sep 29 '22 13:09 aaubry

I'll get it fixed. Not sure why it would have failed either. gitattribes for .sh files was added a while ago.

EdwardCooke avatar Sep 29 '22 13:09 EdwardCooke

Got it fixed. . was overriding the *.sh.

EdwardCooke avatar Sep 29 '22 14:09 EdwardCooke

The . is going to cause additional problems I think. It looks like it may break some of the binary files, like yamldotnet.png. I think I'll remove the . and change it to *.cs to fix it for real. One second.

EdwardCooke avatar Sep 29 '22 14:09 EdwardCooke

And when I just pushed up my changes to git attributes it pushed up the broken files, argh. Stupid gitattributes. Lesson learned there, don't do ..

EdwardCooke avatar Sep 29 '22 14:09 EdwardCooke

This feature has been released in version 12.0.2.

aaubry avatar Oct 07 '22 03:10 aaubry