mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Phillip Wood <>
To: Dmitry Nikulin <>,
	Junio C Hamano <>
Subject: Re: git-diff passes <rev>:<path> args to GIT_EXTERNAL_DIFF incorrectly?
Date: Fri, 30 Aug 2019 11:16:54 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Hi Dmitry

On 29/08/2019 15:36, Dmitry Nikulin wrote:
> Thank you for the reply.
> [...]
> 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 --
> week02_value_based/seminar_vi.ipynb
> week2_model_based/practice_vi.ipynb
> ['./',
>   'week02_value_based/seminar_vi.ipynb',
>   '/tmp/amudWz_seminar_vi.ipynb',
>   '8f8016963c888b7dd8dd20f60b7d6fdb41b26c1d',
>   '100644',
>   '/tmp/Ub7zPz_practice_vi.ipynb',
>   '21db80f53b632d975a9af0acbaf397eb717cde2c',
>   '100644',
>   'week2_model_based/practice_vi.ipynb',
>   '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). 

When git detects a rename it adds two parameters to the end of the 
argument list for the external diff program. The first extra argument is 
the new name and the second is the header with the similarity 
information[1]. I'm not sure why the last argument is being split in 
your example. It is not split in the example below

$git mv git.c renamed.c
$env GIT_EXTERNAL_DIFF='printf "|%s|\\n"' git diff HEAD
|similarity index 100%
rename from git.c
rename to renamed.c

Best Wishes



>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-30 10:17 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
2019-08-30 10:16     ` Phillip Wood [this message]
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).