Git - "Stage selected ranges" clobbers line endings for the entire file without any warning (Windows)
#96,104 建立於 2020年4月24日
倉庫指標
- Star
- (74,848 star)
- PR 合併指標
- (平均合併 14小時 20分鐘) (30 天內合併 999 個 PR)
描述
- VSCode Version: Tested on 1.44.2 and 1.45.0 insiders
- OS Version: Windows 10 Build 18363
Steps to Reproduce:
- Make any change in a file which has CRLF line endings in the git repository

- Stage the change from the git diff UI in vscode using "stage selected ranges"

- use git diff --staged to see the diff of the file (making sure diff.wsErrorHighlight is set to "all", otherwise you still can't see the changes), and see that the line endings for the entire file have now changed:


This is especially insidious if you happen to have core.autocrlf set to true, because the files will continue to look identical on disk when checked out, they will only differ in the repo itself (and when you go to submit a PR, it looks like the whole file changed, but github doesn't identify that the change is in the line endings, which can lead to lots of confusion when you look back on disk and see no change).
Also, the git diff UI in VS Code will not show the differences, even with Ignore Trim Whitespace set to false, which means the user has no idea that his line endings are being clobbered, potentially for weeks or months.
Does this issue occur when all extensions are disabled?: Yes, tested with a fresh install of latest stable (1.44.2) with no extensions