microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
161.18k stars 28.29k forks source link

Root repo folder was deleted after clicking "Delete to Trash" on a commit. now I can't find it in the Trash #201504

Closed NoamNol closed 6 months ago

NoamNol commented 7 months ago

Type: Bug

I had my git repo opened in vscode. There was a commit in remote that wasn’t pulled yet. I right-clicked on the commit and then clicked "Delete to Trash". Now everything inside the repo folder is gone, including the .git folder and ignored files. I have nothing left ):

I also don't see it in the Trash folder (I'm using mac)

Screenshot 2023-12-26 at 15 49 19

VS Code version: Code 1.85.1 (Universal) (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:48:06.308Z) OS version: Darwin arm64 22.2.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 (8 x 24)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|6, 5, 5| |Memory (System)|16.00GB (0.05GB free)| |Process Argv|--crash-reporter-id 134c9b0e-98e0-40e1-a5dd-9996500c1675| |Screen Reader|yes| |VM|0%|
Extensions (54) Extension|Author (truncated)|Version ---|---|--- vscode-nginx-conf|ahm|0.3.2 Bookmarks|ale|13.4.2 ng-template|Ang|17.0.3 atlascode|atl|3.0.9 vscode-django|bat|1.14.0 toml|be5|0.6.0 markdown-preview-github-styles|bie|2.0.3 vscode-tailwindcss|bra|0.10.4 attendant|Cod|1.3.0 vscode-eslint|dba|2.4.2 gitlens|eam|14.6.1 vscode-html-css|ecm|1.13.1 EditorConfig|Edi|0.16.4 prettier-vscode|esb|10.1.0 vscode-jest-runner|fir|0.4.71 auto-rename-tag|for|0.1.10 gitlab-workflow|Git|3.96.1 todo-tree|Gru|0.0.226 gitlab-mr|jas|1.4.3 search-node-modules|jas|1.3.0 vsc-python-indent|Kev|1.18.0 python-sphinx-highlight|leo|0.3.0 dotenv|mik|1.0.1 vscode-docker|ms-|1.28.0 black-formatter|ms-|2023.6.0 isort|ms-|2023.10.1 mypy-type-checker|ms-|2023.6.0 pylint|ms-|2023.10.1 python|ms-|2023.22.1 vscode-pylance|ms-|2023.12.101 remote-containers|ms-|0.327.0 makefile-tools|ms-|0.8.22 remote-explorer|ms-|0.4.1 remote-server|ms-|1.5.0 gremlins|nho|0.26.0 git-semantic-commit|nit|2.0.0 autodocstring|njp|0.6.1 pydoctestbtn|Noa|1.0.7 ansible|red|2.9.118 vscode-yaml|red|1.14.0 pin-up|sae|1.4.1 code-spell-checker|str|3.0.1 vscode-stylelint|sty|1.3.0 tabnine-vscode|Tab|3.54.0 mako|tom|0.2.0 intellicode-api-usage-examples|Vis|0.2.8 vscodeintellicode|Vis|1.2.30 vscodeintellicode-completions|Vis|1.0.22 vscode-icons|vsc|12.6.0 vscode-nginx|wil|0.7.2 fig|wit|0.0.7 change-case|wma|1.0.0 dictionary-completion|yzh|1.2.2 vscode-open-in-github|ziy|1.3.6
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 pythonvs932:30410667 py29gd2263:30899288 vsclangdf:30486550 c4g48928:30535728 dsvsc012cf:30540253 azure-dev_surveyone:30548225 f6dab269:30613381 showlangstatbar:30737416 0bi6i642:30917235 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 dsvsc013:30795093 dsvsc014:30804076 dsvsc015:30845448 pythontestfixt:30902429 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 aa_t_chat:30882232 dsvsc019:30917259 cp7184c:30925681 ```
NoamNol commented 7 months ago
ADTC commented 7 months ago

I feel like this is a GitLens extension problem because VSCode doesn't have a commit browser. Have you tried an extension bisect to reproduce the problem?

Where exactly did you click "Delete to Trash"? Please show a screenshot.

PS: I'm not a VSCode maintainer. Just trying to help.

ADTC commented 7 months ago

Also btw, what exactly where you trying to do? Deleting an arbitrary commit could wreck your repository in unthinkable ways.

As for the loss of your .git repo folder, have you tried any recovery methods? (either via the operating system or via a third party). Recuva could be good if you're on Windows. Please download and extract it to an external disk though, to avoid overwriting the data you're trying to recover. (Although, YMMV when trying to recover an entire .git folder.)

Lesson for future: Never put anything important in the stash. Put it in a branch named STASH-something or DONT-MERGE-something and push it to the remote. You should treat your actual stash as temporary and potentially volatile.

Not sure what you mean by "my ignored files".. do you mean .git/info/exclude? Is there a reason why you're ignoring them only locally, and not committing the ignore decision to .gitignore?

ADTC commented 7 months ago

Ah since you're on Mac, have you had any luck with Time Machine backups? IDK if there's Recuva for Mac, but I'm sure there are recovery tools.

NoamNol commented 7 months ago

@ADTC Thank you, I just added a screenshot.

ADTC commented 7 months ago

That's GitLens extension. You should report this in their repository.

eamodio commented 7 months ago

Really sorry you've experienced this, but GitLens doesn't provide this option. It seems like another extension (or VS Code -- though I don't see it there either) has a menu/command contribution that is attaching to GitLens view items (probably by accident).

Can you please run an extension bisect and see which extension is adding that extra menu option (really the last 3)?

ADTC commented 7 months ago

Thanks @eamodio yeah it seemed super odd that there's a "delete to trash" on a commit, like what does that even mean? Commits are not files or folders! You can't move commits to Trash.

@NoamNol please do Extension Bisect as noted, and report back. (Generally speaking I suggest disabling or removing unnecessary extensions anyway.)

NoamNol commented 7 months ago

I found the extension that caused this! https://marketplace.visualstudio.com/items?itemName=saekiraku.pin-up

NoamNol commented 7 months ago

If possible, I believe extensions shouldn’t be able to delete the .git folder, at least not without user approval

lszomoru commented 6 months ago

@NoamNol, glad to hear that you were able to track down the culprit extension. Extensions do have access to the full node API hence they can perform a wide range of actions in the context of the user running VS Code. Limiting what extensions do is a much broader issue that is outside the scope of this issue, hence I will go ahead and close it.