Skip to content

Add .gitattributes with auto line feed treatment #902

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

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

jarzec
Copy link
Contributor

@jarzec jarzec commented Dec 20, 2023

The * text=auto option causes the line endings in text files to be normalized to LF on check-in, but reset to the platform-specific version on check-out.
This should ensure consistency of the repo throughout development on different platforms, while providing platform-specific line endings in the working directory. After some double-checking this seems to be the safest option to ensure global consistency for multi-platform development.
In its current version .gitattributes lets git decide what is/isn't a text file. This is not an issue in the for cppfront as all files in the repo are text. However, if it becomes necessary, further configuration can be added to the file to ensure certain files/files with certain extensions are treated as binary and so untouched on check-in/check-out.

In addition, to avoid the pain of diffs with only line ending differences in regression tests I have been using:

git diff --ignore-cr-at-eol -- <the file to check>

@hsutter
Copy link
Owner

hsutter commented Dec 20, 2023

Thanks!

@hsutter hsutter merged commit 6f7f09c into hsutter:main Dec 20, 2023
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.

2 participants