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

Re: git diff-tree do not honor diff.orderfile config

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 6, 2024, 07:38 UTC
Message-ID
<xmqqsewn2cnf.fsf@gitster.g>
In-Reply-To
<CAJFVNCfz_-Dvd0ctc4w-2jsthyPFxy=HOutj=3PbNnQ-Gsz84A@mail.gmail.com>
Tiago de Bem Natel de Moura <t.nateldemoura@gmail.com> writes:
Show 9 quoted lines
> What did you do before the bug happened? (Steps to reproduce your issue)
> The config `diff.orderfile` is not being honored in the `git diff-tree` command
> as stated by the documentation.
>
> What did you expect to happen? (Expected behavior)
> The output ordered by the pattern file.
>
> What happened instead? (Actual behavior)
> Output has normal order.

The diff-files, diff-index, and diff-tree ignore most (if not all) of the end-user configuration variables in order to give a stable output, which writers of scripts would expect to see out of these plumbing commands.

Those who use these plumbing commands should still be able to use the equivalent command line option to afffect their behaviour. In this case, something like

	orderfile=$(git config diff.orderfile)
	git diff-tree ${orderfile:+"-O$orderfile"} ...

would be what script writers would do when the output is not for machine consumption inside the script, but is to be shown to the end-user directly and they want to pretend as if they used the 'git diff' Porcelain command, which pays attention to the configuration variable".

But when the command is the final output phase (as opposed to a step in the multi-step logic your script implements, e.g. diff-files produces a list of changed files to be read by other commands and processed by your other commands in the downstream on the same pipeline) and that is why it is a good idea to pay attention to the configuration, using "git diff" not "diff-tree" may be more natural thing to do.

Thanks.
Previous: Tiago de Bem Natel de Moura
Message 6 of 6 in “git diff-tree do not honor diff.orderfile config”
  1. Tiago de Bem Natel de MouraJul 5, 2024
  2. Taylor BlauJul 5, 2024
  3. Jeff KingJul 6, 2024
  4. Junio C HamanoJul 6, 2024
  5. Tiago de Bem Natel de MouraJul 8, 2024
  6. Junio C HamanoJul 6, 2024

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.