Microsoft/vscode
View on GitHubGit - Source Control Tab "Discard Changes" on a file called '*' discards all untracked changes
Open
#133,566 opened on Sep 21, 2021
buggithelp wanted
Repository metrics
- Stars
- (74,848 stars)
- PR merge metrics
- (Avg merge 11h 43m) (1,000 merged PRs in 30d)
Description
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:
- Open workspace in a git repo
- Make lots of new untracked files.
- Create a file called '*' 😛
- In the Source Control tab right click the file '*' and select Discard Changes
- VSCode displays a dialog saying "This file will FOREVER BE LOST if you proceed."
- Click "Delete File"
- vscode runs "git clean -f -q -- '/path/to/dir/*"
- 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. 😭