Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong state of editor buttons when staging/unstaging lines of code #2318

Open
Megamouse opened this issue Sep 8, 2024 · 5 comments
Open

Comments

@Megamouse
Copy link

The Stage/discard buttons are sometimes shown when I'm in the "Staged" view, meaning I can't unstage a line of code.
I'm not sure if it happens this way or the other way around (Unstage button visible in "Unstaged" view) or both.

I haven't really tried pressing the buttons in that state, because I obviously don't want to break any of my code or commits.

It's probably simple to reproduce but I haven't managed to do so right now (maybe it only happens while I'm compiling, suggesting a race condition due to max CPU usage).

It usually resolves itself when I click on another file or do something else that causes the editor to reload.

These are the buttons in question:
image
image

@DanPristupov
Copy link
Contributor

I haven't seen this myself.

It's probably simple to reproduce but I haven't managed to do so right now

We need steps to reproduce this.

@Megamouse
Copy link
Author

I'm sorry but I really can't reproduce it right now.
I'm pushing many commits on an almost daily basis and it happens more often than you might think.
I'll try to remember my steps next time it happens.

@Megamouse
Copy link
Author

@DanPristupov I found out how to reproduce this. See steps 1-6.
In step 7 and 8 I show how I "fix" the issue.

  1. Make some changes with multiple lines of code in 2 or more different files. You'll see the files in the "Unstaged" list.
    image

  2. Double click one of the files to put it into the "Staged" list

  3. Click on one of the still unstaged files
    image

  4. Mark some of the changes with the mouse. You'll see the "Stage/Discard" buttons
    image

  5. Click on the previously staged file. You'll still see the "Stage/Discard" buttons, which is wrong
    image

  6. Move the mouse to the editor and focus the changes. It highlights the staged changes but still shows the "Stage/Discard" buttons, which is still wrong
    image

  7. Move the mouse away and unfocus the changes. The buttons disappear.
    image

  8. Move the mouse to the changes again. The correct "Unstage" button appears.
    image

@Megamouse
Copy link
Author

I also just confirmed that this also happens the other way around (mark code in the staged file and click on an unstaged file).

@Megamouse
Copy link
Author

For completeness' sake:

  • When I click "Unstage" in the still unstaged code, I get an "unexpected error" pop-up with "patch does not apply".
  • When I click "Stage" in the already staged code, I also get an "unexpected error" pop-up with "patch does not apply".
  • When I click "Discard" in the already staged code, I get the inverse changes in the "Unstaged" list, which means if I now accidentally stage those changes (or unstage the staged changes) I'll have irreversibly discarded the changes.

I feel like this last point should be worth getting an additional error pop-up, since you shouldn't be able to discard staged changes from the UI (but apparently git doesn't complain).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants