GitHub’s WebUI is running on a Linux machine, so any text edits will use the native Unix EOL (
.giattributes settings you’ve defined control the rules for EOL normalization, but whether these are going to prevent commits that violate the rules depends on the Git settings on the end user machine.
I’m not sure whether the GH WebUI can solve this problem for you, but there are a few things you might attempt in this respects.
You can add to your repository a pre-commit hook that would execute at every commit a custom script that forces
CRLF EOL normalization on all
*.R files. Since this is a repository settings, even the GH WebUI should honor it.
In this case, all your hook would have to do is execute
unix2dos on every
*.R file in the repository.
NOTE — in theory, you could invoke Git to filter down the list to only files which are actually staged, but probably this could actually result in slower execution than just normalizing every file at each commit (at least, this was my general experience with most repositories, except a few rare cases where ignored files matching the pattern were in the order of hundreds of files that would be unnecessarily processed by the hook).
This solution should be bullet-proof.
You should also consider adding an
.editorconfig file with an EOL rule for R files:
end_of_line = crlf
GitHub supports EditorConfig, so chances are that this rule might be enforced on WebUI commits too (but I’m not sure about this).
.editorconfig settings file is always a good thing.