Skip to content

Hunk staging / unstaging / reset does not work for number of context lines != 3 #1746

@raphCode

Description

@raphCode

Describe the bug
In the options, the number of context lines must be set to exactly 3, otherwise hunk management does not work at all.
That is, staging / unstaging / resetting of whole hunks.

To Reproduce
Steps to reproduce the behavior:

  1. Have multiple unstaged changes scattered across a file, e.g. in line 1 and line 10
  2. Open gitui in the first Tab (Status)
  3. Press O
  4. Set the option Context lines to any other number than 3
  5. Try to stage a single hunk by selecting it and pressing Enter (nothing happens)
  6. Stage the whole file
  7. Try to unstage a single hunk by selecting it and pressing Enter (error: hunk not found)
  8. Unstage the whole file
  9. Try to reset a hunk by selecting it and pressing Shift D (crash: hunk not found)

Expected behavior
Staging, unstaging and resetting works like with number of context lines = 3

Context (please complete the following information):

  • OS: Arch
  • GitUI Version 0.23.0

Related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions