From: Jeff King <peff@peff.net>
To: Mike Hommey <mh@glandium.org>
Cc: git@vger.kernel.org
Subject: Re: git add -p doesn't respect diff.context
Date: Thu, 4 Feb 2016 03:02:40 -0500 [thread overview]
Message-ID: <20160204080239.GC21161@sigill.intra.peff.net> (raw)
In-Reply-To: <20160120063523.GA26490@glandium.org>
On Wed, Jan 20, 2016 at 03:35:23PM +0900, Mike Hommey wrote:
> When doing git add -p, the default of 3 context lines is used, ignoring
> the diff.context.
>
> git add -p is using git-diff-files, and diff.context is being read in
> git_diff_ui_config, so the comment above that function applies:
> /*
> * These are to give UI layer defaults.
> * The core-level commands such as git-diff-files should
> * never be affected by the setting of diff.renames
> * the user happens to have in the configuration file.
> */
>
> I guess the question is whether it's diff-files or add -p that should
> honor diff.context. Or should it have its own separate config?
I think it must be "add -p", as otherwise we risk breaking scripts which
try to build on diff-tree but can't handle extra context (though I have
to admit that unlike something like diff.color, it would be a pretty
poor consumer of a diff that couldn't handle varying context).
We already do something similar with diff.algorithm. I think you could
probably just cargo-cult the handling of $diff_algorithm in
git-add--interactive.perl.
It might also make a nice GSoC microproject.
-Peff
prev parent reply other threads:[~2016-02-04 8:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-20 6:35 git add -p doesn't respect diff.context Mike Hommey
2016-02-04 8:02 ` Jeff King [this message]
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=20160204080239.GC21161@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=mh@glandium.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 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).