Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git launches mergetool without any arguments

On machine A, git mergetool runs Beyond Compare 3 as expected. On machine B, BC3 starts but isn't passed any arguments on the command line, thus showing the intro screen instead of the actual merge.

I copied the config from machine A to machine B, and git config --list is identical apart from the installation path and push.default=simple:

merge.tool=bc3
mergetool.bc3='C:/Apps/BeyondCompare3/BCompare.exe'
mergetool.bc3.cmd='C:/Apps/BeyondCompare3/BCompare.exe'
mergetool.bc3.path=C:\Apps\BeyondCompare3\bcomp.exe
push.default=simple

The only other differences are that machine A has git 1.7.11 under Win7 64-bit, while machine B (the one that doesn't work) has git 1.8.4 under Win8 32-bit.

ProcessHacker shows that the command line on machine A (for the exact same repository, bit for bit) is:

"c:\Program Files (x86)\Beyond Compare 3\bcomp.exe" 
        ./somefile.cs.LOCAL.4192.cs 
        ./somefile.cs.REMOTE.4192.cs
        ./somefile.cs.BASE.4192.cs
        -mergeoutput=somefile.cs /BCompWnd=$00140644

while on the broken machine B it's simply:

c:\Apps\BeyondCompare3\BCompare.exe

Which magic incantation do I need here?

like image 450
Roman Starkov Avatar asked Dec 17 '13 14:12

Roman Starkov


People also ask

What is Mergetool in git?

Use git mergetool to run one of several merge utilities to resolve merge conflicts. It is typically run after git merge. If one or more <file> parameters are given, the merge tool program will be run to resolve differences on each file (skipping those without conflicts).

How do I quit git Mergetool?

How do I cancel a git merge? Use git-reset or git merge --abort to cancel a merge that had conflicts. Please note that all the changes will be reset, and this operation cannot be reverted, so make sure to commit or git-stash all your changes before you start a merge.

How do I change Mergetool?

git mergetool is fully configurable so you can pretty much chose your favourite tool. In brief, you can set a default mergetool by setting the user config variable merge. tool . If the merge tool is one of the ones supported natively by it you just have to set mergetool.


1 Answers

Just a guess: if Git already (in its factory configuration) knows about bc3 tool, it will use mergetool.bc3.path along with standard arguments. If not, it looks for mergetool.bc3.cmd, but this one needs to have the correct arguments indicated in the command:

mergetool.bc3.cmd="'c:/apps/BeyondCompare3/bcomp.exe' '$LOCAL' '$REMOTE' '$BASE' '$MERGED'"

For an obscure reason, on machine B Git doesn't know invocation of bc3, and falls back using mergetool.bc3.cmd which in your case misses the correct arguments. On machine A, Git knows how to talk to BC3, and will use the correct invocation of the tool, using only mergetool.bc3.path.

To validate this delete respectively mergetool.bc3.cmd and mergetool.bc3.path on machine A and B, the behaviours should be exactly the same as you observe.

To fix it, use the complete invocation on mergetool.bc3.cmd.

like image 190
CharlesB Avatar answered Sep 24 '22 16:09

CharlesB