microsoft / vscode

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

File comparison of staged changes, "Revert selected ranges" silently does nothing because comparison is opened in Read-Only mode #175786

Open Alex2357 opened 1 year ago

Alex2357 commented 1 year ago

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

Steps to Reproduce:

What I did

  1. Open any git repo in vscode
  2. Open file for edit and insert 4 empty lines at the top
  3. Stage changes from that file
  4. Right click on staged file and compare. The file is opened in Read-Only mode
  5. Select the range of added 4 empty lines
  6. Click right click and Select from the context menu "Revert Selected Ranges"

What I got:

What I (incorrectly) expected to get:

What I expect to get:

If the message above is too verbose, than at least message like "Staged changes are not supposed to be edited", that will be enough to understand what is going on.

VSCodeTriageBot commented 1 year ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.76.0. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

anthonypillot commented 1 year ago

I can add that the "Git: Stage Selected Ranges" command, from command palette, causes duplicate lines in the Git Index.

I don't know if it's related to this issue. I'll post some details in another issue.

ci-vamp commented 1 year ago

i am having the same issue on 1.78.1 as well a previous version i had to downgrade to (1.74.3).

https://github.com/microsoft/vscode/assets/116516277/ef334d1e-1435-4b2c-88ae-7ae63168391d

ci-vamp commented 1 year ago

i found a workaround but i dont know what the deal is. this wasnt happening before and its occurring in both current and older versions

if you revert and it doesnt find "a spot" for the revert it does nothing. if you add a blank line then revert it works

https://github.com/microsoft/vscode/assets/116516277/13919ef5-bed9-4732-beb0-48f961c6a34f

lszomoru commented 1 year ago

@ci-vamp, could you please file a separate issue as that is unrelated to this problem. Thanks!

douniwan5788 commented 1 week ago

Still no fix, I need to unstage first, then revert...

itai-gendler commented 1 day ago

yeah this is super annoying. can we get this to be fixed please?