From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Jeff King <peff@peff.net>
Cc: Mike McGranahan <mike@mcgwiz.com>, git@vger.kernel.org
Subject: Re: Patch text in git-add patch mode lacks whitespace highlighting
Date: Tue, 4 Feb 2020 20:04:33 +0100 (CET) [thread overview]
Message-ID: <nycvar.QRO.7.76.6.2002042003320.1058@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <20200203145155.GA272077@coredump.intra.peff.net>
Hi Peff,
On Mon, 3 Feb 2020, Jeff King wrote:
> On Mon, Feb 03, 2020 at 01:37:48PM +0100, Johannes Schindelin wrote:
>
> > > The short of my answer is that I think the color-moved stuff might be a
> > > candidate, but it's sufficiently different that I think it should be
> > > decided on as a separate patch.
> >
> > I actually wonder whether we should do something completely different. The
> > problem with `git diff-files --color`, after all, is that `diff-files` was
> > never intended to produce user-facing output, so the `--color` is somewhat
> > of a contradiction here. The fact that `diff-files` is a low-level (or
> > "plumbing") command means that by nature, it wants to control a lot more
> > what the user-provided config can change (typically, scripts calling
> > `diff-files` expect a certain format, and it would not do at all to heed
> > `diff.noPrefix`, for example.
> >
> > In that respect, `git add -p` using `diff-files` is kind of wrong: we
> > _want_ to show the result to the user, with no processing at all (execpt
> > the user-provided `diffFilter`).
>
> Sort of. The problem is that we need two matching copies of the diff:
> one to apply, and one to show the user. They don't need to be
> byte-for-byte identical, but they should correlate at the level of
> individual lines. And the "one to apply" can take on some user-selected
> options, as long as the result can still be applied.
>
> > So why not introduce a new option to `diff-files` and `diff-index` to ask
> > it _specifically_ to heed diff UI config settings? I.e. a command-line
> > option that makes it call
> >
> > git_config(git_diff_ui_config, NULL);
> >
> > instead of
> >
> > git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
>
> Would you pass that option to both of the diff calls, or just the one
> generating the human-readable input?
>
> If just the human-readable one, then many options that change the line
> count would be problems: diff.context, diff.interhunkcontext,
> diff.orderfile, etc.
Darn, you have a very valid point :-(
> If both, then some options would be problematic for applying. Just
> looking over the list, these jump out at me:
>
> - color.diff=always would obviously be an issue (though TBH I think
> anybody doing that is inviting a lot of breakages anyway)
>
> - diff.external would be a problem if it kicked in, though I think it
> would require --ext-diff to actually do anything
>
> - diff.submodule would generate diffs that can't be applied
So I guess it is back to your patch, maybe amended by a move of the
color-moved setting.
Ciao,
Dscho
prev parent reply other threads:[~2020-02-04 19:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-30 21:53 Patch text in git-add patch mode lacks whitespace highlighting Mike McGranahan
2020-01-31 9:19 ` Jeff King
2020-01-31 9:57 ` [PATCH] diff: move diff.wsErrorHighlight to "basic" config Jeff King
2020-02-01 0:48 ` Patch text in git-add patch mode lacks whitespace highlighting Mike McGranahan
2020-01-31 12:37 ` Johannes Schindelin
2020-02-01 0:49 ` Mike McGranahan
2020-02-01 11:02 ` Jeff King
2020-02-01 21:06 ` Johannes Schindelin
2020-02-03 8:54 ` Jeff King
2020-02-03 12:37 ` Johannes Schindelin
2020-02-03 14:51 ` Jeff King
2020-02-04 18:29 ` Junio C Hamano
2020-02-04 19:57 ` Jeff King
2020-02-04 19:04 ` Johannes Schindelin [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
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=nycvar.QRO.7.76.6.2002042003320.1058@tvgsbejvaqbjf.bet \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=mike@mcgwiz.com \
--cc=peff@peff.net \
/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).