I tried writing a simple difftool for this question - Verify that Git commit only moves lines - and it works ... fine I guess, but there is one problem.
When asking it to do a diff between two commits, like this:
git difftool -t OnlyMovedLines HEAD~1 HEAD
Then for each modified file, two temporary files gets created with the snapshots from each of the commits, and then the tool is invoked.
This, however, means that the tool is unable to report which file is actually being diffed, as the filenames could be things like this:
C:\Users\lasse\AppData\Local\Temp/Ol8Kc9_a.txt
C:\Users\lasse\AppData\Local\Temp/WtSX78_a.txt
So my question is this, is there any way for me to add more to the configuration in the .gitconfig file, or are there things like environment variables or whatnot, that can be used to tell the tool which file is actually being compared?
The .gitconfig file looks like this for this particular tool:
[difftool "OnlyMovedLines"]
cmd = 'D:\\path\\to\\netcoreapp3.1\\OnlyLinesMovedDiffTool.exe' $LOCAL $REMOTE
One note about the filenames :
git difftool
alone : the original filename is presented on the terminal before each invocation of the tool (it even comes with a confirm message if you don't use-y
), so you can consider the end user already has the information ;git difftool -d
: the tool will be faced with two directories, and each file to be compared will have it full relative path, so you can use that.Perhaps the answer is you don't have to bother after all :)