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

git-diff passes <rev>:<path> args to GIT_EXTERNAL_DIFF incorrectly?

From
DNDmitry Nikulin <pastafariant@gmail.com>
Date
Aug 27, 2019, 18:24 UTC
Message-ID
<CAH53SykX12SN83=gey8KS_x3cGkXH758sfEieskXnnvos8DMcA@mail.gmail.com>

I wrote a very simple Python script to see which arguments git-diff passes to the external diff program when comparing files across branches:

$ env GIT_EXTERNAL_DIFF=./print_argv.py git diff
origin/branch1:file1.txt origin/branch2:file2.txt
['./print_argv.py',
 'file1.txt',
 '/tmp/QRaIJ1_file1.txt',
 '802b1c4ed7b06162b2ce09b7db72a576695b96e5',
 '100644',
 '/tmp/AZuOJ1_file2.txt',
 '076e8e37a712d8a66c0c3d1a103050dc509ca6ff',
 '100644',
 'file2.txt',
 'index 802b1c4..076e8e3 100644\n']

According to the docs (https://www.git-scm.com/docs/git/2.22.0#Documentation/git.txt-codeGITEXTERNALDIFFcode), git-diff is supposed to pass 7 parameters:

path old-file old-hex old-mode new-file new-hex new-mode

This is not what I am seeing here. Is this a bug or incorrect/incomplete documentation?

Tested with git 2.22.0 and 2.17.1.
Next: Dmitry Nikulin
Message 1 of 12 in “git-diff passes <rev>:<path> args to GIT_EXTERNAL_DIFF incorrectly?”
  1. Dmitry NikulinAug 27, 2019
  2. Dmitry NikulinAug 27, 2019
  3. Junio C HamanoAug 29, 2019
  4. Dmitry NikulinAug 29, 2019
  5. Phillip WoodAug 30, 2019
  6. Dmitry NikulinAug 30, 2019
  7. Phillip WoodAug 30, 2019
  8. Jeff KingAug 30, 2019
  9. Dmitry NikulinAug 30, 2019
  10. Dmitry NikulinAug 30, 2019
  11. SZEDER GáborAug 30, 2019
  12. Junio C HamanoAug 30, 2019

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.