Issue 106: External diff failed
http://code.google.com/p/msysgit/issues/detail?id=106

Comment #1 by sschuberth:
Note: I'll be a little verbose with my explanations, although you are already using
the required wrapper script, in order to offer a guide for other users.

It seems to me you're not configuring your diff tool correctly. First of all, there are two different ways to specify an external diff tool. The first is the method you used, by setting the GIT_EXTERNAL_DIFF variable. However, the variable is supposed to point to the full path of the executable. Moreover, the executable specified by
GIT_EXTERNAL_DIFF will be called with a fixed set of 7 arguments:

old-file old-hex old-mode new-file new-hex new-mode

As most diff tools will require a different order (and only some) of the arguments, you will most likely have to specify a wrapper script instead, which in turn calls
the real diff tool.

The second method, which I prefer, is to configure the external diff tool via "git
config". Here's what I did:

1) Create a wrapper script "git-diff-wrapper.sh" which contains something like

-->8-(snip)--
#!/bin/sh

# diff is called by git with 7 parameters:
# path old-file old-hex old-mode new-file new-hex new-mode

"<path_to_diff_executable>" "$2" "$5" | cat
--8<-(snap)--

As you can see, only the second ("old-file") and fifth ("new-file") arguments will be
passed to the diff tool.

2) Type

$ git config --global diff.external <path_to_wrapper_script>

at the command prompt, replacing <path_to_wrapper_script> with the path to
"git-diff-wrapper.sh", so your ~/.gitconfig contains

-->8-(snip)--
[diff]
        external = <path_to_wrapper_script>
--8<-(snap)--

Be sure to use the correct syntax to specify the paths to the wrapper script and diff
tool, i.e. use forward slashed instead of backslashes. In my case, I have

[diff]
        external = c:/Documents and Settings/sschuber/git-diff-wrapper.sh

in .gitconfig and

"d:/Program Files/Beyond Compare 3/BCompare.exe" "$2" "$5" | cat

in the wrapper script. Mind the trailing "cat"!



--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

Reply via email to