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

Popping stash disallowed with staged changes #1724

Closed
eclairevoyant opened this issue Jun 19, 2023 · 3 comments
Closed

Popping stash disallowed with staged changes #1724

eclairevoyant opened this issue Jun 19, 2023 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@eclairevoyant
Copy link

Describe the bug

Popping a stash with anything staged throws an error:

git error:1 uncommitted changes exist in the index; class=Stash (19); code=Uncommitted (-22)

To Reproduce
Steps to reproduce the behavior:

  1. Add any files to stash
  2. Stage any changes
  3. Attempt to pop stash

Expected behavior

No error should occur, and staged changes should stay staged after popping, because git stash pop works this way.

Screenshots
If applicable, add screenshots to help explain your problem.

Context (please complete the following information):

  • OS/Distro + Version: Linux (stable version from nixpkgs, git version built from source)
  • GitUI Version 0.22.1, I also tested with latest git commit
  • Rust version: unknown for nixpkgs version, 1.70.0 for the latest git commit version

Additional context

n/a

@eclairevoyant eclairevoyant added the bug Something isn't working label Jun 19, 2023
@extrawurst extrawurst added this to the v0.24 milestone Jun 19, 2023
@extrawurst extrawurst added the good first issue Good for newcomers label Jun 19, 2023
@extrawurst
Copy link
Collaborator

we currently do not allow unstashing with conflicts. I wonder if we should just drop that limitation and create files in conflict or first confirm whether that is the desired behaviour because in case of pop the clean stash is gone afterwards

@eclairevoyant
Copy link
Author

eclairevoyant commented Jun 19, 2023

from my testing, it seems even if there are no conflicts, as long as any file is staged it will throw this error. e.g. if I edit file A, stash changes, then edit file B, stage it, popping is no longer allowed by gitui (even though conflicts are impossible)

If there really was a conflict, then git stash pop wouldn't drop the stash either (you would have to manually run git stash drop later on)

@eclairevoyant
Copy link
Author

Looks like this is something libgit2 added for some reason in libgit2/libgit2#3259:

Stash application should stage new files, even when we're not updating the index.

Oh, right, it turns out that we should also block stash application if there are any staged changes.

Closing.

@eclairevoyant eclairevoyant closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants