git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: 'git diff-index' doesn't honor the 'diff.algorithm' variable

From
Dmitry Gutov <dgutov@yandex.ru>
Date
May 15, 2016, 10:25 UTC
Message-ID
<8e5a7045-77f7-acb0-de7f-3e8f72479ec3@yandex.ru>
In-Reply-To
<xmqqshxk7aa8.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On 05/14/2016 09:40 PM, Junio C Hamano wrote:
> The variable belongs to UI config, meant for Porcelain "git diff",
> together with things like "diff.color", "diff.context", etc.

OK, that makes sense. You might want to fix the man page, though, it says, like the 'git diff' one, "For instance, if you configured diff.algorithm variable to a non-default value and want to use the default one, then you have to use --diff-algorithm=default option.".

Show 14 quoted lines
> A script that calls diff-index, if it wants to honor end-users'
> UI config variables, is allowed to use 'git config' to read them and
> turn them into appropriate command line options.  e.g.
>
>     algo=$(git config diff.algorithm)
>     case "$algo" in
>     minimal|histogram|patience) algo=--$algo ;;
>     *) algo= ;;
>     esac
>
>     ...
>     git diff-index $algo ... other args ...
>
> or something like that.

Thanks, but we don't distribute any custom Git porcelains with Emacs. We usually can't rely on bash being available either. Doing an extra process call from Emacs for this niche a feature doesn't seem like a great idea either. To clarify, the problem is that `M-x vc-diff' doesn't honor the diff.algorithm option.

I'll have to see why we using 'git diff-index' there directly. Maybe we could switch to 'git diff'.

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “'git diff-index' doesn't honor the 'diff.algorithm' variable”
  1. Dmitry GutovMay 13, 2016
  2. Junio C HamanoMay 14, 2016
  3. Dmitry GutovMay 15, 2016
  4. Junio C HamanoMay 15, 2016
  5. Dmitry GutovMay 15, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.