With git difftool --dir-diff, I can 'diff a whole tree by preparing a temporary copy'. However, I then lose information about renames. Here's a comprehensive example demonstrating the same.
git init
echo xyz >foo.txt
git add .
git commit -m 'Initial commit'
git mv foo.txt bar.txt
git commit -m 'Renamed'
git difftool --dir-diff --tool meld HEAD^
Meld is used just as an example.
Actual Output
Meld thinks a file was removed and a different file was added. A custom external diff tool which doesn't do similarity analysis would do the same.
Desired Output
Something resembling the output of git diff HEAD^. In theory, I could run a recursive similarity analysis on the left and right directories. However Git knows that foo.txt was renamed to bar.txt, and I'd ideally like this information to be sent to the custom external diff tool.
diff --git a/foo.txt b/bar.txt
similarity index 100%
rename from foo.txt
rename to bar.txt
Git - git-config Documentation | difftool.<tool>.cmd only mentions two arguments, LEFT and RIGHT, the two directories where the files will be made available.
Git - git-difftool Documentation doesn't provide any details on how to accomplish this, either.
How can I achieve correct rename detection without redoing the processing Git already does? Assuming I build my own custom external diff tool (using git config diff.tool custom and git config difftool.custom.cmd custom_command), how can I go about this?

git diffgit difftoolbasically delegates to the target diff tool the complete burden of computing the diff. Look into the options for meld or kdiff3 or ... to see if they have a similarity détection option.