I have made Git to diff some binary files by copying the files to a directory in the Temp
folder in Windows using a .bat
file (or batch script).
The script copies the original file and makes a companion file with extension .txt
which contains the text representation of the binary file. Afterwards, it writes the contents of the generated file using the command
type C:\DOCUME~1\ROGER\CONFIG~1\Temp\roger\file.txt
All that is using Git attributes. Now, I need to use the companion .txt
file to be used in the git difftool
command instead of the original file. How do I tell Git which files it should use when diffing .someExtension
files?
I have tried to make another .bat
file, but the configuration needed in .gitconfig
seems to run only Linux scripts, not Windows which are the ones I need, because Linux doesn't understand the path given by Git, i.e., C:\DOCUME~1\ROGER\CONFIG~1\Temp\
when running the copy command cp
.
This is my .gitconfig
:
[difftool "fmbdiff"]
keepBackup = false
keepTemporaries = false
path = C:/Archivos de programa/Git/cmd/fmbDiffTool.bat
cmd = \"/c/Archivos de programa/Git/cmd/fmbDiffTool.bat\" \"/$LOCAL\" \"$PWD/$BASE\"
So, the questions that might solve the problem are:
Basically, the difftool declares a batch script, which can work with a Windows path like:
/c/xxx
That is what I did in "How do I view 'git diff' output with a visual diff program?" 4 years ago.
But for a more complex script, the easiest way is to make a separate one (exe
or jar
, as you suggests), and call it from the batch script.