Thread (47 messages) flat view 47 messages, 8 authors, 2016-06-15

Re: [RFC PATCH] git-add--interactive: manual hunk editing mode v2

From: Jeff King <hidden>
Date: 2016-06-15 22:44:41

On Thu, Jun 05, 2008 at 11:04:58AM +0200, Thomas Rast wrote:
(Somehow it seems rather ironic that I'm trying to implement a feature
that provides plenty of live bullets, yet keep shooting myself with
the _MUA_.)
Heh.
I should have provided a definition, sorry.  By "your" scheme, I meant
the one where one is restricted to deleting existing lines, and thus
deletes '-' lines to disable them; by "my" scheme, where one is free
to edit and changes '-' lines to context to disable them.
OK, thanks for the clarification.
At least it's my current understanding that, under the above
definition, "your" scheme is what you actually proposed in
  http://www.spinics.net/lists/git/msg67478.html
  [why doesn't Google find gmane?]
but I misunderstood and implemented "my" scheme.
For the record, "my" scheme was only half thought-through, and I think I
actually like "your" scheme better. Once we give the user an editor,
restricting them to a tiny subset of editor operations seems error-prone
and annoying, since we have no way of enforcing those operations except
to wait until after they edit and say "oops, you did something bad."
[Let's just forget about the original patch at the top of the thread;
in retrospect, it _is_ clunky, and the UI didn't get any replies in
favour.]
It seems like Junio isn't all that keen on the raw patch-editing
interface. And even if we do like it, I think there is still room for a
less error-prone but more restrictive feature that mere mortals can use.
So maybe there is a better interface yet.

What about 'S' to do a "line split"; that is, take the current hunk, and
anywhere there are adjacent changed lines, split them into their own
hunks. I.e. the hunk,

   line 1
  +line 2
  -line 3
   line 4
  -line 5

becomes three hunks:

   line 1
  +line 2

  -line 3
   line 4

  -line 5

and then we proceed as usual, staging or not each split hunk. It would
be clunky to separate one or two lines from a huge chunk (since you
would inadvertently split the huge chunk and have to stage each
individually). But in many cases you can split into smaller hunks first
with 's'.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help