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

new diff signs don't work if line endings are crlf #4989

Closed
PORTALSURFER opened this issue Dec 3, 2022 · 5 comments · Fixed by #4995
Closed

new diff signs don't work if line endings are crlf #4989

PORTALSURFER opened this issue Dec 3, 2022 · 5 comments · Fixed by #4995
Assignees
Labels
A-vcs Area: Version control system interaction C-bug Category: This is a bug
Milestone

Comments

@PORTALSURFER
Copy link
Contributor

PORTALSURFER commented Dec 3, 2022

Summary

the new diff signs feature #3890 colors the entire file using the diff.delta markers on windows where files by default will use crlf line endings.
changing the line endings to lf "fixes" the issue.

Reproduction Steps

I tried this:

  1. hx
  2. open a file with code which is tracked by a git repo

I expected this to happen:
image

Instead, this happened:
image

Helix log

No response

Platform

windows

Terminal Emulator

windows terminal

Helix Version

helix 22.08.1 (ee010c4)

@PORTALSURFER PORTALSURFER added the C-bug Category: This is a bug label Dec 3, 2022
@pascalkuthe pascalkuthe self-assigned this Dec 3, 2022
@pascalkuthe
Copy link
Member

pascalkuthe commented Dec 3, 2022

Are you using core.autocrlf=true? That settings causes git to checkout files with CRLF on windows but the objects inside the commits have LF endings . I guess we would need to respect that setting when obtaining the object from git.

Is there already support for that in gitoxide @Byron?

@pascalkuthe pascalkuthe added this to the 22.12 milestone Dec 3, 2022
@Byron
Copy link
Contributor

Byron commented Dec 3, 2022

That's the work of filters, which in this case simply change the line ending style upon checkout and addition to the object database.

gitoxide unfortunately doesn't have support for applying filters yet, so a fix for this on the side of hx isn't immediately possible. However, I believe this will be implemented within the next 6 months or earlier.

In future, one would be able to obtain the object data and pass it through the configured filters to obtain the buffer that git would write to disk, so one compares apples to apples again when diffing.

@pascalkuthe pascalkuthe added the A-vcs Area: Version control system interaction label Dec 3, 2022
@pascalkuthe
Copy link
Member

Thanks for elaborating @Byron. I will be implementing a simole workaround for CRLF in helix (but not support for.gitattrivutes) for the next release. That can be removed when upstream support lands

@kirawi
Copy link
Member

kirawi commented Dec 3, 2022

An immediate workaround is :line-ending lf

@pascalkuthe
Copy link
Member

#4995 will fix most cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vcs Area: Version control system interaction C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants