RadicalxChange / rxc-voice

An app for decentralized democratic governance.
https://voice.radicalxchange.org/
Other
42 stars 14 forks source link

Better manage end of line characters (EOL) in the project #68

Closed DecimalTurn closed 3 years ago

DecimalTurn commented 3 years ago

Since this project might involve developers working on different OS, we have to take a second to make sure we deal with EOL characters in a correct manner. This pull request aims at solving this issue.

Commits:

  1. We need to have a .gitattributes file in order to make sure devs on Windows won't commit Windows-style line endings (CRLF) to the repository that should always use Unix-style line endings (LF). From what I've read (like this), a basic .gitattributes file with * text=auto is probably enough.

  2. Some Windows users might have the setting core.autocrlf=true in their global Git config file which indicates to Git that it should convert LF to CRLF when fetching text files from the repository. This is a problem since the files are meant to run on WSL and not on Windows directly. By forcing core.autocrlf=input during cloning, we make sure that Windows users won't have any issues with an extra "\r" appearing in python scripts, for example.

  3. I ran a small VBA script to check the line endings of files in the current state of the repository. It gave me 4 files that contain CRLF as their line endings. I've changed them back to LF.

Side note regarding commit 3 : Git will detect that all lines from these files have been changed even though nothing has changed except for the line endings. To see there's actually no changes in those files, we can add ?w=1 to the commit URL which gives this showing that there is actually no "real" changes. However, anyone who made changes to any of these files might have some merging conflicts if they try to merge their changes.

DecimalTurn commented 3 years ago

You're welcome and hopefully, it's the last time we'll have to talk about EOL characters!