gitwinmergedifftool

WinMerge via git difftool keeps prompting for second file


I used @VonC's excellent instructions to configure my development system so that git difftool <BRANCH1> <BRANCH1> will invoke WinMerge. Here is what I did:

  1. Placed the following in ~/.gitconfig:

    [diff]

    tool = winmerge
    

    [difftool "winmerge"]

    cmd = winmerge.sh \"$LOCAL\" \"$REMOTE\"
    

    [difftool]

    prompt = false
    
  2. Created a /usr/bin/winmerge.sh with the following content:

    echo Launching WinMergeU.exe: $1 $2

    "C:/Program Files (x86)/WinMerge/WinMergeU.exe" -e -ub "$1" "$2"

Now, when I try to launch WinMerge via git difftool <BRANCH1> <BRANCH1>, I receive what seems to be correct parameter passing:

Launching WinMergeU.exe: /tmp/21qMVb_file1.c /tmp/1ACqik_file1.c

But, for some strange reason, instead of WinMerge displaying the two files side-by-side, it prompts for entering the first file as the right-side, with the second file accepted as the left-side:

[WinMerge should be displaying 2 files not one

Why is this happening? What did I miss in the configuration steps?

P.S. When I type on the command line winmerge.sh file1.c file2.c, WinMerge immediately displays the two files side-by-side, just as I would expect.

UPDATE: Oh wow, I just noticed the Both paths are invalid message at the bottom of WinMerge's prompt (and updated the screenshot to emphasize that). It appears that these files simply weren't generated by difftool or something is wrong with the path.


Solution

  • I solved the problem!

    The solution lies in the hint provided by @pydave's answer in the same thread. All I had to do is replace "$1" "$2" (in winmerge.sh) with cygpath -w $1 cygpath -w $2.

    It works beautifully now. Just as I would expect.