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

Re: [RFC PATCH] {checkout,reset} -p: make patch direction configurable

From: Jeff King <hidden>
Date: 2016-06-15 22:47:46

On Thu, Nov 19, 2009 at 11:03:57PM +0100, Thomas Rast wrote:
When we implemented the -p mode for checkout, reset and stash, some
discussion revolved around the involved patch direction.

Make this configurable for reset and checkout with the following
choices:

             index/HEAD       other
  forward    undo addition    undo addition
  mixed      undo addition    apply removal
  reverse    apply removal    apply removal
[...]
ISTR that Peff wanted this, and maybe some others.  I'm not too
interested because I'm still convinced 'mixed' is the Right Option,
but it was somewhere deep on my todo stack and maybe you like it ;-)
Actually, I am pretty happy with the current "discard this hunk" most of
the time. It is easy enough to see "you made this change, did you want
to get rid of it?". The one exception is during patch editing. Try
something simple like:

cat >file <<EOF
this
is
a
file
with
some
content
in
it
EOF

git add file
git commit -m base

cat >file <<EOF
this
is
a
file
with
some
other
content
EOF

git checkout -p

Now try to 'e'dit the patch to throw away the addition of "other", but
keep the deletion of the other two lines. Do you find it easy or hard?
Now try it with interactive.checkout.direction set to forward. I find
editing the forward direction _much_ simpler.

Assuming you agree, I'm not sure what that tells us, though. I probably
wouldn't personally set interactive.*.direction for the yes/no part. But
I would find it more convenient to do patch editing always in the
forward direction. I'm worried that it would be too jarring to the user,
though, to see the patch presented in one direction but edit it in the
opposite direction. Maybe it would be nice to have yet another
interactive option to swap between the two for this particular hunk, and
then you could edit the direction you prefer.


Junio raised the question of consistency in another thread. I don't see
a consistency problem here. This is by definition an interactive
procedure. I don't see a reason not to allow the user their preferred
style. But I think if I could swap when editing, I would personally not
care all that much about the other direction.

-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