gitui icon indicating copy to clipboard operation
gitui copied to clipboard

hunk error when hunk contains whitespace changes

Open KenMacD opened this issue 1 month ago • 0 comments

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

KenMacD avatar Nov 07 '25 19:11 KenMacD