Subject: Re: [PATCH] Teach git-gui to split hunks

From: Johannes Sixt <[email-masked]>
Date: Thu, 26 Jul 2007 09:32:22 +0200

Johannes Schindelin wrote:
> 
> When you select the context menu item "Split Hunk" in the diff area,
> git-gui will now split the current hunk so that a new hunk starts at
> the current position.
> 
> For this to work, apply has to be called with --unidiff-zero, since
> the new hunks can start or stop with a "-" or "+" line.

For chrissake, NO!

I tried this already, and it immediately corrupted my data.

The problem case is when the hunk you want to apply is not the first one
and the first one does not add and remove the same number of lines. In
this case, all that git-apply can do is to rely on line numbers. But
they are WRONG and apply the patch at the WRONG spot.

First, I didn't believe Linus when he preached that --unidiff-zero is
bad; it took only a day to become a follower. ;)

-- Hannes