lep / jassdoc

Document the WarCraft 3 API
52 stars 20 forks source link

Bite the bullet: Convert blizzard.j to LF (was mixed EOL) #119

Closed Luashine closed 10 months ago

Luashine commented 10 months ago

Closes #109

Blizzard.j is currently 99% CRLF, 1% LF. The rest of the repo is 100% LF (or autocrlf-ed on Windows, depends how you view it). git ls-files --eol where i is the index aka internally saved data.

While researching, I found out Github has the lesser known ?w=1 option to pull request change comparison, with this on it hides whitespace changes. I will update this post with a w=1 link.

I strongly recommend to set this config option to not mix CRLF/LF in the future: git config --local core.safecrlf true it will simply abort git add until you fix the file.

The alternative is to keep the MIXED line-endings inside git, because mixed they will continue to stay mixed in the working dir and cause whiteline clashes down the line, bloating diffs. However manual merging is still easy with this: https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging and git merge -Xignore-space-change whitespace

The rest is explained in #109

lep commented 10 months ago

Thanks for you effort researching this. I meant to reply in the original issue but i guess life got in the way. I think i allready wrote somewhere that this seems fine to me; web interface still works, etc. so i'm just going ahead and merge this. I guess the perl scripts use \n which should be the OS newline but especially with core.safecrlf=true it shouldn't be a problem.

Luashine commented 10 months ago

Yes on Windows when using Lua (which is as low-level as C gets) you must open files in "wb" binary mode else Windows will automatically convert LF to CRLF on output. The only scenario with git I can think of is dual-booting and sharing that folder etc.