From: Johan Herland <johan@herland.net>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Thomas Rast <trast@student.ethz.ch>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v3] git-add--interactive: manual hunk editing mode
Date: Mon, 09 Jun 2008 19:31:51 +0200 [thread overview]
Message-ID: <200806091931.51221.johan@herland.net> (raw)
In-Reply-To: <20080609122938.GA12210@sigill.intra.peff.net>
On Monday 09 June 2008, Jeff King wrote:
> On Mon, Jun 09, 2008 at 07:46:22AM +0200, Johan Herland wrote:
> > Is there a good reason against having *both*?
> >
> > AFAICS, there's nothing stopping us from having both a "-e"-option to
> > git-add, and an "e"-command inside git-add--interactive.
>
> I agree (and I tried to make that point in an earlier mail).
>
> And I was hoping the right way to do it was to simply build the
> interactive "e" command on top of Johannes' git-apply work. But I don't
> think that quite makes sense.
Yeah, the two approaches don't merge easily...
> His work is about fixing up the hunk header as we apply the patch, but a
> working "e" command in the hunk selection should probably not actually
> apply, but simply split into two hunks for the loop.
By "split into two hunks", you mean splitting the original "index ->
worktree" hunk (#0) into one hunk that represents "index -> edited" (#1),
and another hunk that represents "edited -> worktree" (#2)?
>From a technical POV this might make sense, but AFAICS, users would always
want to answer 'y' to #1, and 'n' to #2 (see [1]), so from a user POV,
git-add--interactive should simply stage #1, and drop #2.
(Side note: AFAIR, some of the original rationale for this feature was to
provide a more fine-grained split than 's'. Looking at the problem from
this POV: What is the reason for splitting a hunk in the first place? It
must be because one part of the hunk should be staged while leaving the
other unstaged. With 's', it just splits, and lets the user select which
parts of the hunk to stage, using 'y'/'n'. But 'e' introduces a much more
powerful notion of letting user split AND select in ONE operation (i.e. the
editor). Therefore, when the user has already selected which parts of the
hunk to stage (#1), it is not necessary to re-ask the user whether or not
#1 should be staged (and certainly not #2).
> > ("git-add -e" would open the entire diff in an editor, as would "e"
> > from the *main* menu of git-add--interactive. However, "e" from the
> > *single hunk* menu would of course open only that single hunk within
> > the editor. We could even have an "E" command to open all
> > remaining/undecided hunks in an editor.)
>
> I agree with all of this, though I think the big question is what
> happens to the edited portion. In the interactive command, I think it
> becomes a new hunk that can be staged or not. In "git add -e" it makes
> sense to simply stage the result.
Sounds acceptable to me (although I would also be ok with automatically
staging the edited portion in the interactive command).
Have fun! :)
...Johan
[1]: AIUI #1 represents the hunk that the user want to stage at this moment.
Conversely, #2 represents the changes that the user is NOT interested in
staging at this point. Therefore, the only answers that make sense is 'y'
(i.e. "stage this hunk") for #1 and 'n' (i.e. "do not stage this hunk") for
#2. The only problem with this is if the user screwed up the hunk edit and
wants to revert to the original hunk (#0). I don't know if this is worth
supporting.
--
Johan Herland, <johan@herland.net>
www.herland.net
next prev parent reply other threads:[~2008-06-09 17:33 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-23 20:21 [PATCH] git-add--interactive: manual hunk editing mode Thomas Rast
2008-05-24 1:24 ` Ping Yin
2008-05-29 15:37 ` Thomas Rast
2008-05-29 16:12 ` Johannes Schindelin
2008-05-29 19:10 ` Thomas Rast
2008-05-29 19:16 ` Thomas Rast
2008-05-29 18:58 ` Jeff King
2008-05-30 9:49 ` Johannes Schindelin
2008-05-30 10:46 ` Jakub Narebski
2008-05-30 12:21 ` Thomas Rast
2008-05-30 21:35 ` Junio C Hamano
2008-06-01 0:41 ` [RFC PATCH] git-add--interactive: manual hunk editing mode v2 Thomas Rast
2008-06-01 14:50 ` [RFC PATCH] git-add--interactive: manual hunk editing mode v2.1 Thomas Rast
2008-06-01 15:14 ` Jeff King
2008-06-05 1:46 ` [RFC PATCH] git-add--interactive: manual hunk editing mode v2 Jeff King
2008-06-05 7:53 ` Thomas Rast
2008-06-05 8:11 ` Jeff King
2008-06-05 9:04 ` Thomas Rast
2008-06-05 9:20 ` Jeff King
2008-06-05 9:38 ` Thomas Rast
2008-06-05 9:46 ` Jeff King
2008-06-05 8:16 ` Junio C Hamano
2008-06-05 8:56 ` Jeff King
2008-06-05 10:28 ` Johannes Schindelin
2008-06-06 5:10 ` Jeff King
2008-06-06 6:03 ` Jeff King
2008-06-08 22:33 ` Thomas Rast
2008-06-08 23:06 ` Johannes Schindelin
2008-06-06 14:31 ` Johannes Schindelin
2008-06-08 22:18 ` Thomas Rast
2008-06-08 23:02 ` Johannes Schindelin
2008-06-05 12:38 ` [WIP PATCH v2] git-add--interactive: manual hunk editing mode Thomas Rast
2008-06-08 22:32 ` [PATCH v3] " Thomas Rast
2008-06-08 23:19 ` Johannes Schindelin
2008-06-09 5:46 ` Johan Herland
2008-06-09 12:29 ` Jeff King
2008-06-09 16:13 ` Johannes Schindelin
2008-06-09 19:59 ` Junio C Hamano
2008-06-09 17:31 ` Johan Herland [this message]
2008-06-09 20:17 ` Jeff King
2008-06-09 21:19 ` Johan Herland
2008-06-10 11:05 ` Jeff King
2008-06-11 9:02 ` Thomas Rast
2008-06-12 4:49 ` Jeff King
2008-06-12 6:55 ` Thomas Rast
2008-06-12 7:13 ` Jeff King
2008-06-13 15:48 ` [PATCH v4] " Thomas Rast
2008-06-23 18:38 ` Jeff King
2008-06-23 18:54 ` Johannes Schindelin
2008-06-23 19:57 ` Jeff King
2008-06-23 21:16 ` apply --recount, was " Johannes Schindelin
2008-06-24 5:09 ` Jeff King
2008-06-24 19:07 ` [PATCH 0/3] Manual editing for 'add' and 'add -p' Thomas Rast
2008-06-24 19:53 ` Miklos Vajna
2008-06-24 19:08 ` [PATCH 1/3] Allow git-apply to ignore the hunk headers (AKA recountdiff) Thomas Rast
2008-06-24 23:35 ` Junio C Hamano
2008-06-25 5:45 ` Jeff King
2008-06-27 17:43 ` Johannes Schindelin
2008-06-24 19:08 ` [PATCH 2/3] git-add: introduce --edit (to edit the diff vs. the index) Thomas Rast
2008-06-24 19:08 ` [PATCH 3/3] git-add--interactive: manual hunk editing mode Thomas Rast
2008-06-10 11:19 ` [PATCH v3] " Andreas Ericsson
2008-06-05 9:02 ` [PATCH] " Thomas Rast
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=200806091931.51221.johan@herland.net \
--to=johan@herland.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=trast@student.ethz.ch \
/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).