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

Add .gitattributes file to avoid unwanted CRLF #3954

Merged
merged 1 commit into from Jun 26, 2017

Conversation

@danhunsaker
Copy link
Collaborator

@danhunsaker danhunsaker commented Jun 26, 2017

When Windows checks out files, it defaults to changing line endings to CRLF. If these files are then copied to a Linux system to be run, and the endings aren't changed at some point in that process, things break. This file forces git to use LF for all text files on all systems (except the request testing specfiles) to prevent issues everywhere.

Copy link
Collaborator

@unarist unarist left a comment

This patch breaks test fixtures. HTTP response includes CRLF, so you shouldn't normalize those files.

Only .gitattributes should appears as a changed file.

@danhunsaker
Copy link
Collaborator Author

@danhunsaker danhunsaker commented Jun 26, 2017

Ah. I had wondered about those fixtures. Fixing now.

When Windows checks out files, it defaults to changing line endings to CRLF. If these files are then copied to a Linux system to be run, and the endings aren't changed at some point in that process, things break. This file forces git to use LF for all text files on all systems (except the request testing specfiles) to prevent issues everywhere.
@danhunsaker danhunsaker force-pushed the danhunsaker:bugfix/line-endings branch to 1b37791 Jun 26, 2017
@danhunsaker danhunsaker changed the title Add .gitattributes file to avoid CRLF Add .gitattributes file to avoid unwanted CRLF Jun 26, 2017
@danhunsaker
Copy link
Collaborator Author

@danhunsaker danhunsaker commented Jun 26, 2017

Commit replaced. I tested the updated .gitattributes file to ensure it won't cause git to normalize those files again, and it was successful.

(Thought about forcing them all to CRLF, but decided against that; leaving them untouched across systems, as though they were binary files, allows more flexibility in writing tests...)

*.webm -text
*.woff -text
*.woff2 -text
spec/fixtures/requests/** -text !eol

This comment has been minimized.

@unarist

unarist Jun 26, 2017
Collaborator

!eol seems to be not needed, but it's ok.

This comment has been minimized.

@danhunsaker

danhunsaker Jun 26, 2017
Author Collaborator

Yeah, spare bit of paranoia. I don't trust git as much as I should...

@Gargron Gargron merged commit 7aeb916 into tootsuite:master Jun 26, 2017
2 checks passed
2 checks passed
codeclimate no new or fixed issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@danhunsaker danhunsaker deleted the danhunsaker:bugfix/line-endings branch Jun 26, 2017
YaQ00 pushed a commit to YaQ00/mastodon that referenced this pull request Sep 5, 2017
When Windows checks out files, it defaults to changing line endings to CRLF. If these files are then copied to a Linux system to be run, and the endings aren't changed at some point in that process, things break. This file forces git to use LF for all text files on all systems (except the request testing specfiles) to prevent issues everywhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.