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
Junio C Hamano <gitster@pobox.com>
Date
May 15, 2016, 18:43 UTC
Message-ID
<xmqqwpmv5fi3.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<8e5a7045-77f7-acb0-de7f-3e8f72479ec3@yandex.ru>
Dmitry Gutov <dgutov@yandex.ru> writes:
> 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.".

Thanks; I think the paragraph is shared among the "diff" family of commands both plumbing and Porcelain, so I'd say "patches welcome" at this point ;-).

> Thanks, but we don't distribute any custom Git porcelains with
> Emacs. We usually can't rely on bash being available either.

The script was an illustration of the logic--I am sure elisp is much core capable scripting environment than POSIX shell. Perhaps (setq vc-diff-git-diff-use-histogram t) in ~/.emacs is not too bad ;-)

> I'll have to see why we using 'git diff-index' there directly. Maybe
> we could switch to 'git diff'.
I do not think it is a good idea.

Depending on how much understanding vc-diff wants to have on what the diff output is saying, it may want to be read and parse parts of the output; an end user who has diff.color=always can easily ruin your day.

And no, running "git diff --color=never" is not a solution for that.

The Porcelain "git diff" command is not bound by any promise of stable output and reserves the right to change the default to better support human users. I think the upcoming version of Git turns the diff.renames setting on by default, for example. We might even add a side-by-side diff and make it the default someday. You do not want to be reading these "fancy" output, and you cannot keep updating the invocation of "git diff" by vc-diff with unbounded number options, e.g. --no-side-by-side, that will be added to defeat configuration variables that will be invented in the future.

Previous: Dmitry GutovNext: Dmitry Gutov
Message 4 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.