From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
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: Thu, 13 Dec 2007 10:41:32 +0100 [thread overview]
Message-ID: <4760FE4C.9010806@viscovery.net> (raw)
In-Reply-To: <7vhcin3rv4.fsf@gitster.siamese.dyndns.org>
Junio C Hamano schrieb:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> For this to work, apply has to be called with --unidiff-zero, since
>> the new hunks can start or stop with a "-" or "+" line.
>
> You do not have to do "unidiff zero". Suppose you have this hunk you
> need to split.
>
> diff --git a/read-cache.c b/read-cache.c
> index 7db5588..4d12073 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -12,8 +12,8 @@
> /* Index extensions.
> *
> * The first letter should be 'A'..'Z' for extensions that are not
> - * necessary for a correct operation (i.e. optimization data).
> - * When new extensions are added that _needs_ to be understood in
> + * necessary for a correct operation (that is, optimization data).
> + * When new extensions are added that needs to be understood in
> * order to correctly interpret the index file, pick character that
> * is outside the range, to cause the reader to abort.
> */
...
> That is, , if you want to do finer grained hunk splitting than what "git
> add -p" lets you do, you do _not_ let user specify "I want to split the
> hunk into two, before this point and after this point". Instead, let
> the user pick zero or more '-' line and zero or more '+' line, and
> adjust the context around it. An unpicked '-' line becomes the common
> context, and an unpicked '+' line disappears. After that, you recount
> the diff. That way, you do not have to do any "unidiff zero" cop-out.
In this case I would expect two adjacent hunks: one that covers the selected
changes, another one with the remaining changes, but each against the original:
@@ -12,7 +12,7 @@
/* Index extensions.
*
* The first letter should be 'A'..'Z' for extensions that are not
- * necessary for a correct operation (i.e. optimization data).
+ * necessary for a correct operation (that is, optimization data).
* When new extensions are added that _needs_ to be understood in
* order to correctly interpret the index file, pick character that
* is outside the range, to cause the reader to abort.
@@ -13,7 +13,7 @@
*
* The first letter should be 'A'..'Z' for extensions that are not
* necessary for a correct operation (i.e. optimization data).
- * When new extensions are added that _needs_ to be understood in
+ * When new extensions are added that needs to be understood in
* order to correctly interpret the index file, pick character that
* is outside the range, to cause the reader to abort.
*/
Then I can stage either one. After that operation, git-gui refreshes the
patch display. This is now the time where the hunk that was not staged
should be updated to reflect the correct diff against the staged hunk.
-- Hannes
next prev parent reply other threads:[~2007-12-13 9:42 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
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 [this message]
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=4760FE4C.9010806@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=andyparkins@gmail.com \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jasonsewall@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).