I'm trying to use an external diff tool to compare a given file from two commits. If I select two commits in SourceTree and neither one is currently checked out, the file is checked out from each branch, copied to a temporary location, and the absolute (full) path of each is passed to the external diff tool. Everything works fine.
However, if one of the commits is currently checked out, the absolute path is not passed to the external diff tool. It seems only the filename (or perhaps relative path, based from the root working dir of the git repo) is passed. This causes the external diff to fail because the current working directory is the directory containing the external diff tool, rather than the appropriate directory within the git workspace ($PWD in SourceTree).
If I replace $LOCAL and $REMOTE with $PWD\$LOCAL and $PWD\$REMOTE, respectively, the absolute path for the file in the currently checked-out commit is passed correctly, but of course this breaks the other one (the temporary file path from the branch which is not checked out).
I've also reproduced the same issue with git difftool on the command-line, but of course when running the path on the command-line, the current working directory is correct. Is there a workaround to make SourceTree prepend $PWD\ only when necessary? If not, is there some other solution that will solve my problem?