Kdiff3 won't open with mergetool command
Asked Answered
L

5

25

I have conflicts, so I type:

git mergetool

I then get a message saying:

Hit return to start merge resolution tool

Normally when I do this, it open kdiff3 so I can merge the differences.

now when I do it, it just continues to the next file, and kdiff3 doesn't open at all.

I triple cheched my git config and my system path and all seems perfect. Config file is as follows:

 [merge]
    tool = kdiff3
 [mergetool "kdiff3"]
    path = c:/Program Files (x86)/KDiff3/kdiff3.exe
 [diff]
    guitool = kdiff3
 [difftool "kdiff3"]
    path = c:/Program Files (x86)/KDiff3/kdiff3.exe
 [core]
    editor = \"C:/Program Files (x86)/GitExtensions/GitExtensions.exe\" fileeditor   autocrlf = true
 [user]
    name = James Farrell
    email = [email protected]
 [github]
    user = whygosystems
    token = 87d00c2e613b3a7c8c1be817b75b8a33
 [diff]
    external = C:/Program Files (x86)/Git/cmd/git-diff-wrapper.sh

Anyone have any ideas what might be wrong?

I have a feeling (though I could be wrong, that this has been a problem, since I installed the new Github windows client)....

Lavoisier answered 4/6, 2012 at 14:51 Comment(3)
I have had this issue time to time, and rebooting the machine has always helped. Have no clue as to why.Blotch
@Blotch Thanks, I've rebooted and it hasn't helped.Lavoisier
Had the same problem, for me this workaround helped.Motorboat
G
20

I realize this is old, but for future googlers, KDiff3 also has an option where if the merge is trivial, it will resolve it silently and never even show a window.

I've had that happen to me in the past, so it might be what's happening for you. I think the option is called 'Auto save and quit on merge without conflicts'.

Glacier answered 5/2, 2013 at 14:43 Comment(1)
This option is indeed the culprid, but it is always triggered because git calls kdiff3 with the --auto flag, so it doesn't help to disable the option in kdiff3. For a workaround see my answer to this similar question.Motorboat
A
6

I haven't used git for this purpose on Windows in a while, but your config file shows some interesting differences re: program strings.

[core]
    editor = \"C:/Program Files (x86)/GitExtensions/GitExtensions.exe\" fileeditor   autocrlf = true

vs

[difftool "kdiff3"]
    path = c:/Program Files (x86)/KDiff3/kdiff3.exe

I suspect that there might be some issue with the spaces in the program name. Try setting your diff/mergetool executable paths to:

path = \"c:/Program Files (x86)/KDiff3/kdiff3.exe\"
Accord answered 4/6, 2012 at 16:32 Comment(0)
R
2

Again, for future Googlers:

As of version 2.48.02 (29 November 2014), Git Extensions started distributing the 64-bit version of kdiff3. (See https://github.com/gitextensions/gitextensions/blob/master/GitUI/Resources/ChangeLog.md#version-24802-29-november-2014.)

So if you're running a 32-bit OS and had the Git Extensions installer install kdiff3, your kdiff3 won't even run by itself. The solution is to download the 32-bit version (http://sourceforge.net/projects/kdiff3/files/kdiff3/) and reinstall. I didn't even need to uninstall the 64-bit version first, as the installer simply overwrote the previous install.

Rudimentary answered 16/1, 2015 at 17:58 Comment(0)
B
1

Git has --auto hard coded as a command-line option to KDiff3, which causes the GUI not to show up if all conflicts are auto-resolvable by KDiff3.

We can change this default behavior by setting:

git config --global mergetool.kdiff3NoAuto.cmd "/c/Program Files/KDiff3/kdiff3.exe --L1 \"\$MERGED (Base)\" --L2 \"\$MERGED (Local)\" --L3 \"\$MERGED (Remote)\" -o \"\$MERGED\" \"\$BASE\" \"\$LOCAL\" \"\$REMOTE\""

which result in the ~/.gitconfig file (or you can directly modify the file):

[merge]
        tool = kdiff3
[mergetool "kdiff3"]
        path = C:/Program Files/KDiff3/kdiff3.exe
        trustExitCode = false
        cmd = \"/c/Program Files/KDiff3/kdiff3.exe\" --L1 \"$MERGED (Base)\" --L2 \"$MERGED (Local)\" --L3 \"$MERGED (Remote)\" -o \"$MERGED\" \"$BASE\" \"$LOCAL\" \"$REMOTE\"
[diff]
        guitool = kdiff3
[difftool "kdiff3"]
        path = C:/Program Files/KDiff3/kdiff3.exe
        trustExitCode = false

In this way, the kdiff3 will alway open whether there is still unsolved conflicts left.

Ref: https://mcmap.net/q/437720/-how-could-i-force-mergetool-gui-kdiff3-to-be-always-shown

Buckie answered 30/11, 2020 at 9:14 Comment(1)
Thanks for this. Solved the error while writing error I had been getting.Adonic
G
0

Yet another answer for future Googlers:

Actually, no external merge tool will start. An issue was filed in August 2015: https://jira.atlassian.com/browse/SRCTREEWIN-3543

Glen answered 30/10, 2015 at 23:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.