Re: Patch text in git-add patch mode lacks whitespace highlighting
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 3, 2020, 12:37 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2002031320180.46@tvgsbejvaqbjf.bet>
- In-Reply-To
- <20200203085456.GD2164@coredump.intra.peff.net>
Hi Peff,
On Mon, 3 Feb 2020, Jeff King wrote:
Show 20 quoted lines
> On Sat, Feb 01, 2020 at 10:06:43PM +0100, Johannes Schindelin wrote: > > > > > If my reading is correct, and we want `git diff-files --color` to respect > > > > the `diff.wsErrorHighlight` setting, then this patch fixes that: > > > > [...] > > > > The bigger question is whether other core developers agree with this? And > > > > what other `diff.*` settings should be respected by `git diff-files` (and > > > > of course, `git diff-index`)? > > > > > > I think you can take my posting of an identical patch elsewhere in the > > > thread as a "yes". :) > > > > Thank you ;-) > > > > That answer only applies to the first question, though. The second > > question, whether other `diff.*` settings would like to enjoy the same > > treatment, is still open for debate... > > I hoped you would read the other part of the thread where I mused on > that same question. :)
Sorry, I totally missed that. Will re-read.
> 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`).
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 */
?
Ciao, Dscho