From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Schindelin Subject: Re: [PATCH] Teach git-gui to split hunks Date: Wed, 12 Dec 2007 20:39:14 +0000 (GMT) Message-ID: References: <402731c90712110548k67f28b64w5afa93ee908ce73b@mail.gmail.com> <31e9dd080712111114t2bbdba60m18b7d6210f3f9174@mail.gmail.com> <402731c90712111254q1cb99c6al47538971d93b4592@mail.gmail.com> <31e9dd080712111329j2c8b22ebs38ab727a5fbe85fb@mail.gmail.com> <20071212041002.GN14735@spearce.org> <31e9dd080712112113u44b30c62ja012951fba958c5d@mail.gmail.com> <20071212052329.GR14735@spearce.org> <31e9dd080712120702k36a959cfh3e2a5c5fb076d922@mail.gmail.com> <31e9dd080712121050i45981ed5u845b71f0e73aa8e2@mail.gmail.com> <7vk5nj7jkp.fsf@gitster.siamese.dyndns.org> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Jason Sewall , "Shawn O. Pearce" , David , Marco Costalba , Andy Parkins , git@vger.kernel.org To: Junio C Hamano X-From: git-owner@vger.kernel.org Wed Dec 12 21:40:02 2007 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1J2YMq-0000XT-PL for gcvg-git-2@gmane.org; Wed, 12 Dec 2007 21:39:45 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756203AbXLLUjS (ORCPT ); Wed, 12 Dec 2007 15:39:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755738AbXLLUjS (ORCPT ); Wed, 12 Dec 2007 15:39:18 -0500 Received: from mail.gmx.net ([213.165.64.20]:46396 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752990AbXLLUjR (ORCPT ); Wed, 12 Dec 2007 15:39:17 -0500 Received: (qmail invoked by alias); 12 Dec 2007 20:39:14 -0000 Received: from unknown (EHLO [138.251.11.74]) [138.251.11.74] by mail.gmx.net (mp041) with SMTP; 12 Dec 2007 21:39:14 +0100 X-Authenticated: #1490710 X-Provags-ID: V01U2FsdGVkX19aqogs+QhadmUkfIxHFzKkrPojD0KS67332XY5tb 2zCcEPoEt+Dovr X-X-Sender: gene099@racer.site In-Reply-To: <7vk5nj7jkp.fsf@gitster.siamese.dyndns.org> X-Y-GMX-Trusted: 0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Hi, On Wed, 12 Dec 2007, Junio C Hamano wrote: > Johannes Schindelin writes: > > > 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. ... > > I still have conceptual problem with this whole thing. For example, > what does that MEAN to split this hunk from your patch... > > > @@ -296,7 +369,7 @@ proc apply_hunk {x y} { > > if {$current_diff_path eq {} || $current_diff_header eq {}} return > > if {![lock_index apply_hunk]} return > > > > - set apply_cmd {apply --cached --whitespace=nowarn} > > + set apply_cmd {apply --cached --whitespace=nowarn --unidiff-zero} > > set mi [lindex $file_states($current_diff_path) 0] > > if {$current_diff_side eq $ui_index} { > > set failed_msg [mc "Failed to unstage selected hunk."] > > ... by clicking between the '-' and '+' lines, and apply only one half? > > Well, the question was not very well stated. I know what it means -- > remove that old line, without replacing with the corrected/updated one. > The real question is how would that be useful? The thing is: sometimes there is a patch which contains just one garbage line. (I am talking about my current working tree, so you are not allowed to be offended by my language in this case.) The thing I would like to do is right click on that line, start a new hunk, then right click on the next line to start yet another hunk, and apply this and the first hunk. It is a lazy way to edit a patch. Ciao, Dscho