mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Dmitry Nikulin <>
To: Junio C Hamano <>
Subject: Re: git-diff passes <rev>:<path> args to GIT_EXTERNAL_DIFF incorrectly?
Date: Thu, 29 Aug 2019 17:36:00 +0300	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Thank you for the reply.

On Thu, 29 Aug 2019 at 06:54, Junio C Hamano <> wrote:
>     $ 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).

The context here is that I am trying to diff two Jupyter notebooks
using an external tool (git-nbdiffdriver in my case). Therefore, for
me it is crucial to use the external tool, and not Git's internal

For the particular command that you suggested as the replacement, on
my demo repository it does not produce anything interesting, as it
does not detect renames and calls my honeypot twice:

$ env GIT_EXTERNAL_DIFF=./ git diff -M origin/branch1
origin/branch2 -- file1.txt file2.txt

However, for the original repository where I first faced this problem
(, Git passes a very
weird set of args to the external diff:

$ env GIT_EXTERNAL_DIFF=./ git diff -M master coursera --
 'similarity index 82%\n'
 'rename from week02_value_based/seminar_vi.ipynb\n'
 'rename to week2_model_based/practice_vi.ipynb\n'
 'index 8f80169..21db80f 100644\n']

I would guess that this is a bug. There can clearly be a hotfix (after
all, Git passes all of the information to the external that it should
per the spec, that is, <old|new>-path, <old|new>-hex, <old|new>-mode;
adding, however, some garbage). I do not know though to what extent
this information is correct. You say that this information is lost
when I use the <tree-ish>:<path> notation; however, Git seems to pass
paths and hexes correctly. This only leaves open the question of file
mode. Perhaps it could be preserved at least for some cases, such as
when the blob is retrieved from a path in a tree?

  reply	other threads:[~2019-08-29 14:36 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
2019-08-29 14:36   ` Dmitry Nikulin [this message]
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).