Sublime Forum

Odd line endings


I’m getting some odd issues within Sublime, when used with GitSavvy. It was all working fine but now I’ve found certain files are rendering with line endings being displayed:

The other thing I’ve noticed is that when I try stage hunks using GitSavvy on any file formatted this way I get the following error:

C:\Program Files\Git\cmd\git.EXE apply --unidiff-zero --cached - failed with following output:

error: patch failed: campusm-rds-push-lambda/src/handlerFactory.js:2
error: campusm-rds-push-lambda/src/handlerFactory.js: patch does not apply

I’ve got a pre-commit hook set up in Git using prettier, and I’m using the Linux subsystem in windows for a lot of stuff (but the actions on a save I believe should be pure windows).

Can anyone advise or provide some pointers on what I should look at?



0x0d is a carriage return. It looks to me like you loaded the file with linux line endings, but then something converted it to CRLF. Reopening the file should fix that, but clearly GitSavvy is not happy about CRLF.



Actually, when does Sublime show these line endings? Hard to reproduce, I don’t remember I ever had these.

@IPWright83 Did you have autocrlf = True? What does Sublime tell you (in the statusbar) about the line ending. Afaik we basically read the file contents using git show HEAD:filename or similar, and then fancy annotate.

Surprisingly the code does a split('\n') (not a splitlines()) after that (and I don’t see code for normalizing line endings before that), but how could I reproduce this. I’m on Windows as well, and never had this.



I’ll let you know next time I see this. I’m using the Linux subsystem (Ubuntu with WSL 1) so there’s a chance some cross between something Linux has done and the windows editing of the file is going odd.

I’ve only ever seen it in the “stage hunk” view, which I’m assuming is some variation of the diff view.