All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Jean-François Veillette" <jean_francois_veillette@yahoo.ca>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jason Sewall <jasonsewall@gmail.com>,
	"Shawn O. Pearce" <spearce@spearce.org>, David <davvid@gmail.com>,
	Marco Costalba <mcostalba@gmail.com>,
	Andy Parkins <andyparkins@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] Teach git-gui to split hunks
Date: Wed, 12 Dec 2007 14:54:02 -0800	[thread overview]
Message-ID: <7vbq8v7cdx.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7A812021-DCEC-49D4-895B-2DCBEFA7CA2E@yahoo.ca> (Jean-François Veillette's message of "Wed, 12 Dec 2007 15:50:47 -0500")

Jean-François Veillette <jean_francois_veillette@yahoo.ca> writes:

>> 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?
>
> I often get big hunk just because I modified whitespaces around
> relevent pieces of code, the ability to segment the changes and only
> pick isolated and specific lines for a commit (not commiting
> whitespaces surrounding real code changes) would be very welcome.
> Maybe I should know better, but the actual hunk selection in git gui
> is quite good already, but the ability to be more precise on how a
> hunk is defined is a welcome change.

Oh, I wasn't questioning the usefulness of hunk splitting in general.
It is sometimes useful and that is why we have "add -i".

If you have something like this:

        @@ -j,k +l,m @@
         common 1
         common 2
        -preimage
        +postimage
         common 3
        -deleted
         common 4
         common 5

I think it makes sense to split it into two logical (overlapping) hunks:

        @@ -j,(k-3) +l,(m-2) @@
         common 1
         common 2
        -preimage
        +postimage
         common 3

and

        @@ -j,(k-3) +l,(m-3) @@
         common 3
        -deleted
         common 4
         common 5

and being able to apply one of them independent from the other, or
re-combine them back into one hunk.

I was just questioning if it makes sense to split a hunk like this in
the middle of -/+ lines:

	@@ -j,k +l,m @@
	 common
	 common
	-pre 1
	-pre 2
        -pre 3
        +post 1
	+post 2
	 common

You could split between "-pre 2" and "-pre 3", but I do not think that
would be so useful.  It is a different story if you allowed the above to
first be transformed into this way (assuming that "pre 1" and "pre 2"
corresponds to "post 1"):

	@@ -j,k +l,m @@
	 common
	 common
	-pre 1
	-pre 2
        +post 1
        -pre 3
	+post 2
	 common

and then be split between "+post 1" and "-pre 3".  That may make sense
in some context.

  reply	other threads:[~2007-12-12 22:55 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-11 13:48 [ANNOUNCE] ugit: a pyqt-based git gui // was: Re: If you would write git from scratch now, what would you change? David
2007-12-11 18:20 ` Marco Costalba
2007-12-11 19:14   ` Jason Sewall
2007-12-11 19:33     ` Marco Costalba
2007-12-11 20:54       ` David
2007-12-11 21:29         ` Jason Sewall
2007-12-12  4:10           ` Shawn O. Pearce
2007-12-12  5:13             ` Jason Sewall
2007-12-12  5:23               ` Shawn O. Pearce
2007-12-12 15:02                 ` Jason Sewall
2007-12-12 18:15                   ` Johannes Schindelin
2007-12-12 18:50                     ` Jason Sewall
2007-12-12 19:37                       ` [PATCH] Teach git-gui to split hunks Johannes Schindelin
2007-12-12 20:18                         ` Junio C Hamano
2007-12-12 20:39                           ` Johannes Schindelin
2007-12-12 20:50                           ` Jean-François Veillette
2007-12-12 22:54                             ` Junio C Hamano [this message]
2007-12-12 23:02                           ` Wincent Colaiuta
2007-12-13  7:35                         ` Johannes Sixt
2007-12-13  7:48                           ` Shawn O. Pearce
2007-12-13 12:25                           ` Johannes Schindelin
2007-12-13  8:45                         ` Junio C Hamano
2007-12-13  9:41                           ` Johannes Sixt
2007-12-13 12:49                           ` Johannes Schindelin
2007-12-13 14:03                             ` Johannes Sixt
2007-12-13 14:18                               ` Johannes Schindelin
2007-12-13 14:39                                 ` [PATCH] git-gui: Move frequently used commands to the top of the context menu Johannes Sixt
2007-12-14  6:32                                   ` Shawn O. Pearce
2007-12-11 22:37 ` [ANNOUNCE] ugit: a pyqt-based git gui // was: Re: If you would write git from scratch now, what would you change? Alex Riesen
2007-12-11 23:08   ` Steffen Prohaska
2007-12-12  0:11 ` Jakub Narebski
  -- strict thread matches above, loose matches on Subject: below --
2007-07-26  5:32 [PATCH] Teach git-gui to split hunks Johannes Schindelin
2007-07-26  5:48 ` David Kastrup
2007-07-26  7:07   ` Shawn O. Pearce
2007-07-26 14:34     ` Johannes Schindelin
2007-07-26  7:32 ` Johannes Sixt
2007-07-26 14:26   ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vbq8v7cdx.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=andyparkins@gmail.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jasonsewall@gmail.com \
    --cc=jean_francois_veillette@yahoo.ca \
    --cc=mcostalba@gmail.com \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.