You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both files open in nvim with the correct CRLF endings ff=dos. However, file1.ps1 is diffed correctly and file2.ps1 shows all lines as being changed. The only difference between the files is the git index eol value. My guess is that the diff algorithm is assuming LF eol when compairing against the git index and flagging all lines with i/crlf as changes.
git diff does not show any differences.
This case appears to be handled correctly in lewis6991/gitsigns.nvim.
The i/crlf issue can be worked around by setting eol=crlf in .gitattributes and ensuring git config --local --add core.autocrlf true. Then you can run git add --renormalize path/to/files and commit to switch the git index version to LF.
Neovim version
v0.10.0-dev-3103+gca735c755
Steps to reproduce
Configure nvim with default mini-diff (using lazy.nvim): require('mini.diff').setup()
Configure .gitattributes to have *.ps1 text eol=crlf
Check in a file to git with CRLF line endings and git config --local --add core.autocrlf input
Open a file with i/crlf w/crlf attr/text=auto eol=crlf
Expected behavior
There will be no lines with changes
Actual behavior
While git diff shows no changes, every line is shown by mini.diff to have changed
The text was updated successfully, but these errors were encountered:
Indeed, 'mini.diff' does not account for different eol, mostly because I do not have experience (and hence problems) with them. It is good to have some example which I can rely on to potentially fix the issue. I'll take a look.
I have finally had the energy to look at this. As it is quite a confusing topic for me right now.
I think you are right and the issue is indeed "the diff algorithm is assuming LF eol when compairing against the git index". @bockel, would you mind confirming it?
Could you replace this line in your installed copy of 'mini.nvim' / 'mini.diff' with the following:
Contributing guidelines
Module(s)
mini-diff
Description
Diff is not properly handled if the git index line endings are set to CRLF.
Looking at the return information for
git ls-files --eol
:Both files open in nvim with the correct CRLF endings
ff=dos
. However,file1.ps1
is diffed correctly andfile2.ps1
shows all lines as being changed. The only difference between the files is the git index eol value. My guess is that the diff algorithm is assuming LF eol when compairing against the git index and flagging all lines withi/crlf
as changes.git diff
does not show any differences.This case appears to be handled correctly in lewis6991/gitsigns.nvim.
The
i/crlf
issue can be worked around by settingeol=crlf
in .gitattributes and ensuringgit config --local --add core.autocrlf true
. Then you can rungit add --renormalize path/to/files
and commit to switch the git index version to LF.Neovim version
v0.10.0-dev-3103+gca735c755
Steps to reproduce
require('mini.diff').setup()
*.ps1 text eol=crlf
git config --local --add core.autocrlf input
i/crlf w/crlf attr/text=auto eol=crlf
Expected behavior
There will be no lines with changes
Actual behavior
While
git diff
shows no changes, every line is shown by mini.diff to have changedThe text was updated successfully, but these errors were encountered: