-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
^M not stripped off in Windows #927
Comments
Can you provide a minimal example file that causes this? What do the CRLF line endings look like? Is CR ( |
This issue is common on all the files I have in my git repo.
The issue is not in checked out file but the file fetched by gitsigns. This needs a strip off which is skipped for an empty line which did existed in original file. If this extra line wasn't added by gitsigns then util.strip_cr() works fine. |
Not reproducible for me.
Yes, I'm aware, but the checked in file is still a file. Can you answer my original question please and show me how the CRLF's are arranged in a minimal file. I don't have a windows machine so I can't easily find this out. |
I am able to reproduce by doing |
When scanning for CRLF do not check EOF. Fixes #927
Description
I am using neovim in windows and in
Gitsigns diffthis
^M is not stripped off from the buffer.I have debugged the code and found that the check fails here
https://github.com/lewis6991/gitsigns.nvim/blob/6e05045fb1a4845fe44f5c54aafe024444c422ba/lua/gitsigns/util.lua#L199C5-L199C35
Somehow lines read from git have a extra entry in array which is empty and for the last item in the array this check fails as #xs0[i] is 0.
I fixed this case locally by adding the check as
I am not sure if this location is correct for fix.
Neovim version
NVIM v0.10.0-dev-1801+g2ebd328a7
Operating system and version
Windows
Expected behavior
^M should be stripped off in windows.
Actual behavior
^M remains if the buffer which makes
Gitsigns diffthis
command not useful.Minimal config
Steps to reproduce
nvim --clean -u minimal.lua
Gitsigns debug messages
No response
The text was updated successfully, but these errors were encountered: