Microsoft/vscode

Git - Source Control Tab "Discard Changes" on a file called '*' discards all untracked changes

開放

#133,566 建立於 2021年9月21日

 (0 則留言) (0 個反應) (1 位負責人)TypeScript (39,847 個分叉)batch import
buggithelp wanted

倉庫指標

星標
 (184,936 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.60.1
  • OS Version: MacOS 11.3 / RHE Linux 7.6

Steps to Reproduce:

  1. Open workspace in a git repo
  2. Make lots of new untracked files.
  3. Create a file called '*' 😛
  4. In the Source Control tab right click the file '*' and select Discard Changes
  5. VSCode displays a dialog saying "This file will FOREVER BE LOST if you proceed."
  6. Click "Delete File"
  7. vscode runs "git clean -f -q -- '/path/to/dir/*"
  8. You have lost all your untracked work, not just the file '*' as the dialog suggests.

Not really sure what the solution here is. Not sure exactly how you would modify the git command to be compatible with a filename of '*'. But certainly the operation vscode performed did not match the operation selected or the text of the dialog box warning.

You might think it absurd that someone would make this filename, or even expect vscode to handle it elegantly. However at 01:10 in the morning, I did this, and it was painful. 😭

貢獻者指南