mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <>
To: Dmitry Nikulin <>
Subject: Re: git-diff passes <rev>:<path> args to GIT_EXTERNAL_DIFF incorrectly?
Date: Wed, 28 Aug 2019 20:54:45 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <> (Dmitry Nikulin's message of "Tue, 27 Aug 2019 21:24:02 +0300")

Dmitry Nikulin <> writes:

> $ env GIT_EXTERNAL_DIFF=./ git diff
> origin/branch1:file1.txt origin/branch2:file2.txt

I didn't even know external-diff driver is called (and does not even segfaut)
in the "compare two blobs" hack codepath.

The syntax <tree-ish>:<path-in-the-tree> you have on the command
line resolves to a blob object name.  There is no leading directory
name, there is no permission bits or executable bit, there is no
filename, when "diff" is told to compare two blob objects this way.
THe "diff" machinery that drives the external (or internal for that
matter) diff will only get two 40-hex blob object names and nothing
else.  The only pieces of information you can trust among those the
external program may receive are the blob object name(s) and the
contents stored in the temporary files given to it.  The location of
these temporary files or their mode bits have no relation to the
"files" in some tree in the original repository, as that information
is long lost when you write <tree-ish>:<path-in-the-tree> to tell
Git to use that as a blob object name.

    $ git diff -M branch1 branch2 -- file1 file2

if file1 and file2 have similar-enough contents, may have a better
chance of what you wanted to ask Git (if I am guessing what it is,
that is).

  parent reply	other threads:[~2019-08-29  3:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27 18:24 git-diff passes <rev>:<path> args to GIT_EXTERNAL_DIFF incorrectly? Dmitry Nikulin
2019-08-27 22:25 ` Dmitry Nikulin
2019-08-29  3:54 ` Junio C Hamano [this message]
2019-08-29 14:36   ` Dmitry Nikulin
2019-08-30 10:16     ` Phillip Wood
2019-08-30 13:23       ` Dmitry Nikulin
2019-08-30 14:17         ` Phillip Wood
2019-08-30 14:27         ` Jeff King
2019-08-30 15:28           ` Dmitry Nikulin
2019-08-30 15:51             ` Dmitry Nikulin
2019-08-30 14:29         ` SZEDER Gábor
2019-08-30 16:26           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).