From: Shawn O. Pearce Date: Thu, 13 Dec 2007 07:48:25 GMT Subject: Re: [PATCH] Teach git-gui to split hunks Message-ID: <20071213074825.GX14735@spearce.org> In-Reply-To: <4760E0CF.1030805@viscovery.net> Johannes Sixt wrote: > Johannes Schindelin schrieb: > > 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. > > NACK! --unidiff-zero eats your data. Yea, don't worry about that, I won't be applying any patch to git-gui that feeds data to git-apply with --undiff-zero. Not unless its completely bullet-proof that the hunk headers will *never* be wrong. I'd rather always apply with context and let git-apply do its thing to validate the hunks. If you can get the hunk headers computed right you can also get the context computed right, which means git-apply can actually verify the patch can be applied, thus double checking the splitter. > Reason: --unidiff-zero can only look at the line numbers. And those are > wrong because it doesn't account for the shift in line numbers caused by the > first hunk. -- Shawn.