Is there an existing issue for this?
Description
In the case of unstaging a hunk that is not yet staged, if there is another hunk from the same file that is already staged, then that hunk will be unstaged instead.
Expected Behavior
Nothing happens.
Steps To Reproduce
- Stage a file with more than one hunk in the diff.
- Unstage the first hunk.
- Unstage that same hunk again from the unstaged changes list.
- See error
Environment
- OS: NixOS 23.05
- gex: 0.3.9-dev (1cff11992adc67b3cffa05722124800043396740)
Anything else?
This is because when we go into the interactive mode, we use the index of the hunk in that particular diff in the unstaged list, then spawn interactive unstaging in a child process, then use the index from before to determine which hunk to make an action on.