jupyter / nbdime

Tools for diffing and merging of Jupyter notebooks.
http://nbdime.readthedocs.io
Other
2.66k stars 159 forks source link

the git diff driver gives empty output when only mode changes #561

Open cipri-tom opened 3 years ago

cipri-tom commented 3 years ago

Problem

$ git diff path/to/notebook.ipynb
$ 

Expected

$ HOME=/tmp/ git diff path/to/notebook.ipynb
diff --git a/path/to/notebook.ipynb b/path/to/notebook.ipynb
old mode 100644
new mode 100755

In the Expected part, I override the HOME folder so that git ignores the nbdime configuration for notebooks.

vidartf commented 3 years ago

It would probably be nice to add such support, so if you or someone else wants to contribute such a feature, that would be very welcome 👍 The mode is passed to the command via these args: https://github.com/jupyter/nbdime/blob/75363a026f600171952b9456fc2cdafcbb8c8007/nbdime/args.py#L381 https://github.com/jupyter/nbdime/blob/75363a026f600171952b9456fc2cdafcbb8c8007/nbdime/args.py#L384

Then it would be an issue to figure out at which place to display it, but the git diffdriver entry is here: https://github.com/jupyter/nbdime/blob/75363a026f600171952b9456fc2cdafcbb8c8007/nbdime/vcs/git/diffdriver.py#L109

I'm assuming somewhere in the prettyprint might be the right place, but probably other code is needed as well.