All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: enrico <enrico.guiraud@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: more novice-friendly behaviour of `git add -p`
Date: Fri, 20 May 2016 08:05:44 -0700	[thread overview]
Message-ID: <xmqq7feohirb.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <loom.20160520T150517-391@post.gmane.org> (enrico's message of "Fri, 20 May 2016 13:06:15 +0000 (UTC)")

enrico <enrico.guiraud@gmail.com> writes:

> Hello all,
> I have encountered a couple of non-necessary difficulties when editing a
> patch during a `git add -p`.
>
> Firstly, the help message says
> "To remove '-' lines, make them ' ' lines (context)."
> which is a bit confusing because that "them" refers to '-', not to 'lines'.

I think that sentence refers to a line line this in a patch:

    -This is what the line used to be

as a '-'-line.  A line that does not change between preimage and
postimage have SP instead of '-' at the beginning, and the sentence
seems to refer to it as a ' '-line.  So from that reading, "turning
'-'-lines that you do not want to loes into ' '-lines" is perfectly
sensible phrasing.

In any case, "edit" is about giving a low-level access and precise
control to people who are familiar with (1) what each line of "diff"
output means and (2) what is done to them by "patch" (rather, in
Git's context, "apply").

I agree with you that "edit" mode is a too-advanced tool for those
who are not comfortable with these two things.  A solution would
however not be to modify "edit" mode (which would affect those who
are prepared to and want to use the "low-level access and precise
control" to their advantage), but to introduce an easier-to-use,
and perhaps a bit limited for safety, mode for those who are not the
target audience for "edit" mode.

The "split" subcommand to split the hunk before applying was an
attempt to go in that direction; it never allows you the user to
make an arbitrary change to corrupt the patch and make it unusable.
Perhaps you can mimick its spirit and come up with a new "guarded
edit" command?

  reply	other threads:[~2016-05-20 15:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-20 13:06 more novice-friendly behaviour of `git add -p` enrico
2016-05-20 15:05 ` Junio C Hamano [this message]
2016-05-20 15:32   ` enrico

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=xmqq7feohirb.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=enrico.guiraud@gmail.com \
    --cc=git@vger.kernel.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.