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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you for the reply.

On Thu, 29 Aug 2019 at 06:54, Junio C Hamano <gitster@xxxxxxxxx> 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
machinery.

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=./print_argv.py git diff -M origin/branch1
origin/branch2 -- file1.txt file2.txt
['./print_argv.py',
 'file1.txt',
 '/tmp/2IEKCw_file1.txt',
 '802b1c4ed7b06162b2ce09b7db72a576695b96e5',
 '100644',
 '/dev/null',
 '.',
 '.']
['./print_argv.py',
 'file2.txt',
 '/dev/null',
 '.',
 '.',
 '/tmp/oAMdDx_file2.txt',
 '076e8e37a712d8a66c0c3d1a103050dc509ca6ff',
 '100644']

However, for the original repository where I first faced this problem
(https://github.com/yandexdataschool/Practical_RL), Git passes a very
weird set of args to the external diff:

$ env GIT_EXTERNAL_DIFF=./print_argv.py git diff -M master coursera --
week02_value_based/seminar_vi.ipynb
week2_model_based/practice_vi.ipynb
['./print_argv.py',
 '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). 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?



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux