Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: (un)staging an already (un)staged hunk may cause the wrong hunk to be affected #27

@Piturnah

Description

@Piturnah

Is there an existing issue for this?

  • I have searched the existing issues

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

  1. Stage a file with more than one hunk in the diff.
  2. Unstage the first hunk.
  3. Unstage that same hunk again from the unstaged changes list.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions