dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
22.46k stars 372 forks source link

🚀 How to force diff in text mode for binary file? #516

Open robinmoussu opened 3 years ago

robinmoussu commented 3 years ago

Hi, I guess that what I’d like to do already exists, but I wasn’t able to find the option in the documentation.

I have a file that is mostly text, except for a single \0 in the middle. I have another one which is text + ansi escape color code. If I run git diff --text with delta as the difftool, the diff is perfectly rendered. However, if I run git difftool -x delta --text, I got the following message:

Binary files old and new differ

I also get the same message if I try to run delta manually from the command line. How do I force delta to do the diff in text mode for binary file? Something like --text. I did not found anything useful by searching text and binary in the help, or in the Readme.

tgross35 commented 1 month ago

diff has the -a/--text flag which just treats all files as text, it would be great to have this option in delta.

th1000s commented 1 month ago

As you can see, delta can show the input if it actually reaches it. In the other cases the difftools which pipe data into delta need the --text flag. For the standalone delta file1 file case, with #1697 you will be able to call it with -@=--text.