git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: John Keeping <john@keeping.me.uk>, git@vger.kernel.org
Subject: Re: Different diff strategies in add --interactive
Date: Mon, 10 Jun 2013 17:11:41 -0400	[thread overview]
Message-ID: <20130610211140.GD13333@sigill.intra.peff.net> (raw)
In-Reply-To: <7v38sphiiw.fsf@alter.siamese.dyndns.org>

On Mon, Jun 10, 2013 at 12:28:55PM -0700, Junio C Hamano wrote:

> John Keeping <john@keeping.me.uk> writes:
> 
> > I think the first thing to do is read the "diff.algorithm" setting in
> > git-add--interactive and pass its value to the underlying diff-index and
> > diff-files commands, but should we also have a command line parameter to
> > git-add to specify the diff algorithm in interactive mode?  And if so,
> > can we simply add "--diff-algorithm" to git-add, or is that too
> > confusing?
> 
> Making "git add--interactive" read from diff.algorithm is probably a
> good idea, because the command itself definitely is a Porcelain.  We
> would probably need a way to defeat the configured default for
> completeness, either:
> 
>     git add -p --diff-algorithm=default
>     git -c diff.algorithm=default add -p
> 
> but I suspect that a new option to "git add" that only takes effect
> together with "-p" is probably an overkill, only in order to support
> the former and not having to say the latter, but I can be persuaded
> either way.

Worse than that, you would need to add such an option to "checkout -p",
"reset -p", "stash -p", etc. I think the latter form you suggest is
probably acceptable in this case.

Overall, I think respecting diff.algorithm in add--interactive is a very
sane thing to do. I would even be tempted to say we should allow a few
other select diff options (e.g., fewer or more context lines). If you
allowed diff options like this:

  git add --patch="--patience -U5"

that is very flexible, but I would not want to think about what the code
does when you pass --patch="--raw" or equal nonsense.

But I cannot off the top of my head think of other options besides -U
that would be helpful. I have never particularly wanted it for "add -p",
either, though I sometimes generate patches to the list with a greater
number of context lines when I think it makes the changes to a short
function more readable.

-Peff

  reply	other threads:[~2013-06-10 21:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 14:28 Different diff strategies in add --interactive John Keeping
2013-06-10 19:28 ` Junio C Hamano
2013-06-10 21:11   ` Jeff King [this message]
2013-06-10 21:46     ` John Keeping
2013-06-10 21:56       ` Jeff King
2013-06-12 18:44         ` [PATCH] add--interactive: respect diff.algorithm John Keeping
2013-06-12 19:18           ` Jeff King
2013-06-23 19:19           ` Junio C Hamano
2013-06-23 19:50             ` John Keeping
2013-06-23 20:37               ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130610211140.GD13333@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=john@keeping.me.uk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).