How can I make SnailSvn use vimdiff or any custom diff script? It only has a predefined list of options.
To setup its diff support (for opendiff aka FileMerge), it asks you to copy the following script to:
~/Library/Application Scripts/net.langui.SnailSVN.DiffTool/difftool.sh
#!/bin/bash
pkill -nf ScriptMonitor
sh "$@"
The argument is a generated diff-cmd.sh file that looks something like this:
#/bin/bash
"/Applications/Xcode.app/Contents/Developer/usr/bin/opendiff" "/var/folders/nn/000000000000000000000000000000/T/net.langui.SnailSVNFree//r422640 Code.cs" "/Users/idbrii/code/game/Assets/Standard Assets/Unlit/Planes/Code.cs"
I tried to replace it with something like:
#!/bin/bash
args=$(grep opendiff "$@" | cut -d\ -f2-)
echo mvimdiff $args >> ~/snailsvndifftool.log 2>&1
But instead I get too many files — despite files containing quotes, they're still split up by spaces.
Best Answer
With the help of this answer, I found
eval
:However, doing
eval
on arbitrary arguments seems unnecessarily insecure and I couldn't get arrays to work (i.e.,mvimdiff ${args[@]}
), so instead I force mvimdiff to be at the beginning of the line and only allow a set of characters:There's probably something I'm missing, so I hope someone has a better answer.