Reputation: 83
I'm trying to use emacs ediff as a git difftool.
I have followed some of the configurations proposed here: Using ediff as git mergetool
When it comes to comparing between different git revisions of a certain file, I have not problem at all: ediff works well and the differences between both versions are depicted properly.
However, I'm having problems when I try to run git difftool to compare the current directory version of a file with a certain git revision. For some files, I'm getting the following error:
apply: Wrong type argument: arrayp, nil
It is weird, because this error only comes for certain files, not all of them.
I have experimented with several files, and I think that the rule of thumb is as follows: - If the file to be compared is not placed in the git root directory, then it fails. - Otherwise, ediff shows the differences between the current version of the file and the specified revision without any problem.
I have tried with some of the configurations explained in the link I referred to above. All of them give me the same result: git difftool fails when comparing the current directory version of a non-root git file with a certain git revision.
Any idea how this can be fixed?
Thanks a lot. -Bob
Upvotes: 8
Views: 5443
Reputation: 6412
Git knows about a number of standard diff/merge tools, including ediff/emerge. Try
git config --global diff.tool ediff
and invoke it with
git difftool --tool=ediffclient master -- <file>
or similar. ediffclient
will use emacsclient and not start a new emacs, which I prefer but YMMV.
EDIT (in response to a comment): If git complains about edifftool, try adding the following to your global git config file ($HOME/.gitconfig
):
[difftool "ediff"]
cmd = emacs --eval \"(ediff-files \\\"$LOCAL\\\" \\\"$REMOTE\\\")\"
[difftool "ediffclient"]
cmd = emacsclient --eval \"(ediff-files \\\"$LOCAL\\\" \\\"$REMOTE\\\")\"
I was under the impression that these settings are part of the installation but maybe I'm wrong (or maybe that changed in a more recent version of git). I'll try to dig a little deeper when I find some time.
Upvotes: 10