git difftool - how to identify moved files

I wonder if / how it is possible for a diff / merge tool to see that a file has been moved? When conducting my own experiments I do not know how to do this.


$ git status
På grenen master
Din gren är à jour med "origin/master".

Ändringar att checka in:
(använd "git reset HEAD <fil>..." för att ta bort från kö)

ändrad: my_simple_receipe.txt
namnbytt: another_recipe.txt -> second_recipe.txt
namnbytt: subdirectory/subdir_file.xft -> subdirectory/subdir_file.xtt

$ cat ~/.gitconfig

#guitool = meld
guitool = gittool
[difftool "gittool"]
cmd = gittool --verbose --diff --local=\"$LOCAL\" --remote=\"$REMOTE\"

(sorry for the Swedish language above, but essentially my_simple_receipe.txt is changed, another_receipe.txt has moved to second_recipe.txt and subdirectory/subdir_file.xft has moved to subdirectory/subdir_file.xff)

gittool is a small application I have made to see what git passes on to the tool. When looking inside those directories, this is what I see:

$ git difftool --cached -y
(1) DEBUG: Local file: /tmp/vXpNGj_my_simple_receipe.txt
(2) DEBUG: Remote file: my_simple_receipe.txt
(3) DEBUG: Local file: /tmp/Rh8WxF_another_recipe.txt
(4) DEBUG: Remote file: /tmp/pt5MwF_second_recipe.txt
(5) DEBUG: Local file: /tmp/2xoYXi_subdir_file.xft
(6) DEBUG: Remote file: subdirectory/subdir_file.xtt

From the $REMOTE and $LOCAL variables that git creates the subdirectories seem to be gone all the time in the case of $LOCAL. In the case of $REMOTE that varies as you can see above; in (2) it is the same name as the original, in (4) it seem to have been copied to the /tmp directory, and in (6) it is kept as the original. Given this, how can you possible understand if a file has been moved or not?

Hi @jockep123,

Thanks for being here! To be honest I’m not certain this is even possible, perhaps taking a look at how other tools work for example: might help.