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
Contributor

@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
Contributor

@unarist unarist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Contributor Author

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 changed the title Add .gitattributes file to avoid CRLF Add .gitattributes file to avoid unwanted CRLF Jun 26, 2017
@danhunsaker
Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Gargron Gargron merged commit 7aeb916 into mastodon:master Jun 26, 2017
@danhunsaker danhunsaker deleted the bugfix/line-endings branch June 26, 2017 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants