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

file-contents-sorter changes all newlines to unix-style '\n' #958

Closed
Maetveis opened this issue Sep 6, 2023 · 0 comments
Closed

file-contents-sorter changes all newlines to unix-style '\n' #958

Maetveis opened this issue Sep 6, 2023 · 0 comments

Comments

@Maetveis
Copy link
Contributor

Maetveis commented Sep 6, 2023

The file-contents-sorter hook replaces all windows-style newlines '\r\n' with linefeed '\n'.

This is especially confusing when using the hook in a git repository with core.autocrlf activated (the default in git for windows, and also used by windows GitHub runners). In this case the hook always fails (and replaces the newlines), but git shows no diff at all, due to line normalization.
This particular case can be worked around by setting gitattributes, but IMO the hook shouldn't be modifying line separators (mixed-line-ending can be used for that).

@Maetveis Maetveis changed the title file-contents-sorter changes newlines to unix-style '\n' file-contents-sorter changes all newlines to unix-style '\n' Sep 6, 2023
@asottile asottile closed this as completed Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants