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

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

From
DNDmitry Nikulin <pastafariant@gmail.com>
Date
Aug 30, 2019, 13:23 UTC
Message-ID
<CAH53SykQWLtjt0gWVrz5KyH-9WyqaQ0GtkhmyLt09QEqcAS_dw@mail.gmail.com>
In-Reply-To
<9c280a3f-6a1a-61d1-a255-1dcf0671d39c@gmail.com>
On Fri, 30 Aug 2019 at 13:16, Phillip Wood <phillip.wood123@gmail.com> wrote:
> I'm not sure why the last argument is being split in
> your example. It is not split in the example below
I have replicated the splitting issue on my small demo repo [1]:
$ env GIT_EXTERNAL_DIFF=./print_argv.py git diff -M origin/branch1
origin/branch1-mv -- file1.txt file1-mv.txt
['./print_argv.py',
 'file1.txt',
 '/tmp/EWaCSc_file1.txt',
 '2bef330804cb3f6962e45a72a12a3071ee9b5888',
 '100644',
 '/tmp/mtEiSc_file1-mv.txt',
 'f8fd6737fbe5a45c97ba9c9de495dc46ff11eccd',
 '100644',
 'file1-mv.txt',
 'similarity index 90%\n'
 'rename from file1.txt\n'
 'rename to file1-mv.txt\n'
 'index 2bef330..f8fd673 100644\n']

This is, however, tangential to the original problem: documenting the external diff CLI interface for diffing two blobs. Here is what I am seeing:

$ env GIT_EXTERNAL_DIFF=./print_argv.py git diff
origin/branch1:file1.txt origin/branch1-mv:file1-mv.txt
['./print_argv.py',
 'file1.txt',
 '/tmp/n9USvy_file1.txt',
 '2bef330804cb3f6962e45a72a12a3071ee9b5888',
 '100644',
 '/tmp/Zst0uy_file1-mv.txt',
 'f8fd6737fbe5a45c97ba9c9de495dc46ff11eccd',
 '100644',
 'file1-mv.txt',
 'index 2bef330..f8fd673 100644\n']

The meaning and origin of the last arg remains mysterious, and the other args do not conform to the published documentation[2], which states that the args should be:

    path old-file old-hex old-mode new-file new-hex new-mode
Instead the args that are passed are:
    path old-filename old-file old-hex old-mode new-file new-hex
new-mode new-filename something

[1]: https://github.com/dniku/git-external-diff-argv [2]: https://www.git-scm.com/docs/git#Documentation/git.txt-codeGITEXTERNALDIFFcode

Previous: Phillip WoodNext: Phillip Wood
Message 6 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.