Skip to content

hunk error when hunk contains whitespace changes #2774

@KenMacD

Description

@KenMacD

Describe the bug

When attempting to stage changes, if the Ignore whitespaces view option is set and the change has whitespace change the result is a:

hunk error: git error:hunk at line ___ did not apply; class=Patch (31); code=ApplyFail (-35)

To Reproduce
Steps to reproduce the behavior:

  1. Create the following file in a git repo:
a
b
c
d
e
f
g
h
i
  1. Make a change with whitespace and actual changes in a hunk
a
b
c
   z
   e
   z
g
h
i
  1. Run gitui
  2. Click the right arrow to open the diff of the file
  3. Click return to attempt to stage the hunk

Expected behavior

Either the hunk should be staged or a clear error explaining to disable the whitespace option should be displayed.

Context (please complete the following information):

  • OS/Distro + Version: NixOS Unstable
  • GitUI Version 0.27.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions