Git launches mergetool without any arguments

263 views Asked by At

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?

1

There are 1 answers

2
CharlesB On BEST ANSWER

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.