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

CRLF #835

Closed
thekaganugur opened this issue Jul 4, 2023 · 4 comments · Fixed by #928
Closed

CRLF #835

thekaganugur opened this issue Jul 4, 2023 · 4 comments · Fixed by #928
Labels
bug Something isn't working Stale windows Issue specific to the windows platform

Comments

@thekaganugur
Copy link

Description

I'm working on a project that is mostly developed by Windows users while I'm on WSL2. When opening any file with Windows line endings (\r\n) every line is reported as being changed, so that gitsigns is not useful anymore working on these buffers.

Neovim version

0.9.1

Operating system and version

Windows11 with WSL2

Expected behavior

If there is no difference except line endings gitsgings should ignore it.

Here is an example of Vscode
image

Actual behavior

image

Minimal config

for name, url in pairs{
  gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
} do
  local install_path = vim.fn.fnamemodify('gitsigns_issue/'..name, ':p')
  if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
  end
  vim.opt.runtimepath:append(install_path)
end

require('gitsigns').setup{
  debug_mode = true, -- You must add this to enable debug messages
}

Steps to reproduce

  1. nvim --clean -u minimal.lua
  2. Open a file that is saved with windows line endings while on linux.

Gitsigns debug messages

No response

@thekaganugur thekaganugur added the bug Something isn't working label Jul 4, 2023
@lewis6991 lewis6991 added the windows Issue specific to the windows platform label Jul 4, 2023
@lewis6991
Copy link
Owner

lewis6991 commented Jul 4, 2023

I've tried to implement this correctly by tracking the input and working crlf settings in git, but obviously this doesn't work fully across the full myriad of windows setups.

Unfortunately I don't use windows or have access to it, so I rely on contributions to support this.

@lewis6991 lewis6991 added the help wanted Extra attention is needed label Sep 22, 2023
@lewis6991
Copy link
Owner

The testsuite has an exact test for the minimal repro provided here, so that clearly isn't enough to produce the issue:

https://github.com/lewis6991/gitsigns.nvim/blob/94656269a37957dd85c4bf760375002750f870c7/test/gitsigns_spec.lua#L290-302

@lewis6991 lewis6991 added needs response and removed help wanted Extra attention is needed labels Sep 22, 2023
@github-actions
Copy link
Contributor

This has been labeled stale since a request for information has not been answered for 30 days.

@dyskette
Copy link

For me this was happening when I had a file with lf endings, but my .editorconfig had end_of_line = crlf. So, neovim was picking that up with the builtin .editorconfig support: https://neovim.io/doc/user/editorconfig.html#editorconfig_end_of_line and setting fileformat to dos in the buffer.

I changed my .editorconfig end_of_line to lf and the issue went away after closing/opening neovim. Checking set fileformat? returns unix after the change in my .editorconfig.

lewis6991 added a commit that referenced this issue Dec 12, 2023
When scanning for CRLF do not check EOF.

Fixes #927, #835
@lewis6991 lewis6991 linked a pull request Dec 12, 2023 that will close this issue
lewis6991 added a commit that referenced this issue Dec 12, 2023
When scanning for CRLF do not check EOF.

Fixes #927, #835
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale windows Issue specific to the windows platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants