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
Junio C Hamano <gitster@pobox.com>
Date
Aug 30, 2019, 16:26 UTC
Message-ID
<xmqqlfvazkj1.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190830142932.GJ8571@szeder.dev>
SZEDER Gábor <szeder.dev@gmail.com> writes:
Show 21 quoted lines
> Another Python 2 vs 3 issue, perhaps?
>
>   # Python2, good:
>    ...
>    'f8fd6737fbe5a45c97ba9c9de495dc46ff11eccd',
>    '100644',
>    'file1-mv.txt',
>    'similarity index 90%\nrename from file1.txt\nrename to
>   file1-mv.txt\nindex 2bef330..f8fd673 100644\n']
>   # Python3, bad:
>   ...
>    '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']
>
> Let's just stick to plain old printf for now, as suggested by Phillip
> earlier, to reduce unnecessary confusion.

I notice that the latter is pretty-printed. Pay attention to the last few lines that end without a trailing comma. Literal string concatenation taking place to form a single string here, in which case both are giving us the same string?

By the way, sorry for an earlier response based on what I misremembered, which may have confused the discussion unnecessarily. Ever since 65056021 ("built-in diff.", 2006-04-28) made "git diff" a built-in, we had used (or at least attempted to use) <path> from <treeish>:<path>, so it is not unexpected to see paths in two blob diff output.

Previous: SZEDER Gábor
Message 12 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.