sublime_merge
sublime_merge copied to clipboard
Mixed line endings on discard hunk/discard lines and error on second discard for same file when using MSYS2 git as Git Binary
Version info
- OS: Windows 8.1, Windows 10
- Build: 2077
Description Incorrect line endings on discard hunk/discard lines when using MSYS2 git.
MSYS2 git checks out "LF" line endings while Sublime Merge uses "CRLF" line endings for discards resulting in mixed line endings. After one discard Sublime Merge will not be able to do any further discards for that file and shows following error:
error: patch failed: test.lua:40
error: test.lua: patch does not apply
Steps to reproduce
Steps to reproduce the behavior:
- Install MSYS2 from https://www.msys2.org/
- Set the "Git Binary" Setting in Sublime Merge to C:\msys64\usr\bin\git.exe
- Clone a repository with MSYS2 git using cmd.exe e.g:
C:\msys64\usr\bin\git.exe clone [email protected]:picolove/picolove.git
- Change 2 separate lines in a file in the repository (e.g. test.lua) so you get two hunks in Sublime Merge
- Discard the first hunk or discard lines for the first change
- Discard the second hunk
Expected behavior
Sublime Merge will discard lines with the same line endings as the configured "Git Binary" would. Multiple discards work as expected.
Actual behavior
Discarded lines of the first hunk have now CRLF line endings (can be seen as ^M in vim or with Notepad++) Second hunk will throw an error when attempting to discard
error: patch failed: test.lua:40
error: test.lua: patch does not apply
Hi @Shoozza,
Thanks for reaching out - I've been unable to reproduce this behavior with Sublime Merge and MSYS2 git.
Would you mind sharing your Sublime Merge debug information when you get a chance?
This can be found via the application menu under Help > Debug Information
. Before sharing this, please take a moment to redact any information you feel is sensitive such as file paths, Git user info, remotes etc.
Thanks, - Dylan from Sublime HQ