Re: [PATCH 0/2] Support diff.wordDiff config
- From
Olliver Schinagl <oliver@schinagl.nl>
- Date
- Mar 22, 2024, 21:59 UTC
- Message-ID
- <71f2d0e3-d3e5-4d6a-96d5-863a47b3ffc4@schinagl.nl>
- In-Reply-To
- <CAOLa=ZR6tN8eQhByaUobj3kS9wwYegsOQNT8cjZYA-YATJJt7w@mail.gmail.com>
On 02-03-2024 19:02, Karthik Nayak wrote:
Show 16 quoted lines
> On Sat, Mar 2, 2024 at 6:03 PM Junio C Hamano <gitster@pobox.com> wrote: >> >> Karthik Nayak <karthik.188@gmail.com> writes: >> >>> This patch series adds the diff.wordDiff config option. This mimics the >>> '--word-diff' option of `git-diff(1)`. >> >> Is it even be sensible to introduce this configuration variable in >> the first place? What would this do to users who set this variable >> and use third-party or their own scripts that run "git diff" under >> the hood? > > This is definitely a good question to ask. I'm primarily not a user of this > option, and this patch series was more of to start this discussion, based > on the request. I'm comfortable dropping the patch series too if it doesn't > make much sense.
As a human user, I would very much like to see this feature :) It helps much to visually distinct things, but `git diff` sits way to deep in my muscle memory to remember my alias. Also, we have a configuration system to set configuration options for many things.
I wonder though, how many other configuration options we already have, that potentially break 'random scripts' because the user has set it ...
Show 34 quoted lines
> >> >> The usual answer is "these tools should be using the low-level >> plumbing commands like diff-files, diff-index, and diff-tree", so I >> am not worried about it too much myself, and the above is purely the >> devil's advocate comment. >> >> Having said that, running >> >> $ git grep -e 'git diff ' >> >> in the collection of scripts I use [*] to work on this project, I am >> reminded that I may have to be a bit more conservative than I >> currently am about the risk of breaking scripts with the changes >> like the one being proposed. >> >> The proposed feature also may break those who use the git-prompt and >> diff-highlight available in conrib/, even though I am not sure how >> badly they would break, because I only looked at the lines given by >> this command: >> >> $ git grep -e 'git diff ' -- \*.sh ':!t/' >> >> and didn't check how the output from 'git diff' is used. >> >> >> [Footnote] >> >> * They can be seen in the 'todo' branch, if anybody is interested. > > Having said that, wouldn't this cause a problem only if the config is set up? > Meaning the user must explicitly set `diff.wordDiff` for their scripts > to potentially > break. In that sense, is it a breaking feature?