-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
"This diff contains a change in line endings from X to Y" banner is wrong #18691
Comments
Thanks for the issue @Niko-O. I tested this out and I believe this banner is correct based on the default of
When you commit line endings are converted to LF, but when checking out files they are converted to CRLF. If I set Generally I would recommend adding |
Please clarify: Did you set autocrlf to false (globally) before creating the repository? Or did you happen to set it after you've already committed the files?
I do not have a .gitattributes file in my repository. I created the repository by creating a new folder, opening a terminal in it, executing
Do I need to do that before adding any files to the repository? |
The problem
"This diff contains a change in line endings from 'LF' to 'CRLF'." would indicate that the file previously contained LF line endings and either all or a subset of those were changed to be CRLF line endings. This is not the case in my case!
The file has previously contained CRLF line endings and was changed to LF line endings. That's the other way around! The wrong banner is very confusing!
Release version
3.3.14 (x64)
Operating system
Windows 11
Steps to reproduce the behavior
OriginalCrLf.txt
and fill it with multiline text that uses CRLF line endings.OriginalLf.txt
and fill it with multiline text that uses LF line endings.OriginalCrLf.txt
to LF and those ofOriginalLf.txt
to CRLF.Log files
No response
Screenshots
OriginalCrLf.txt
contained CRLF line endings originally and was changed to have LF line endings. The diff shows the entire text being replaced with the same text (i.e. it's not being smart about detecting that only line endings have changed) and the banner says "from 'LF' to 'CRLF'", which is wrong.OriginalLf.txt
contained LF line endings originally and was changed to have CRLF line endings. The diff shows "No content changes found" (i.e. it's being smart about detecting that only line endings but no other text has changed) and no banner is visible:Additional context
The following is the output of
git config --list --show-origin
executed in the repository that contains the changed file (sensitive information replaced with[...]
):Git is intentionally configured to tell me about line ending changes and to not change them automatically.
The following is the output of
git diff --word-diff-regex=.
:The text was updated successfully, but these errors were encountered: