1

I'm trying to merge a branch which has a different .NET .dll and .pdb, and git/BC4 is trying to do a text merge on the files instead of letting me choose local vs remote.

I've never experienced this before, presumably I have changed some setting or BC4 has some difference to BC3.

My relevant .gitconfig

[merge]
    tool = bec3
    renamelimit = 2000
[mergetool]
    prompt = false
    keepBackup = false
[mergetool "bec3"]
    cmd = \"C:/Program Files (x86)/Beyond Compare 4/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"
    trustExitCode = true

I'm using msysgit 1.9.5 and Beyond Compare 4.0.3

Edit: I dont want to binary merge, git used to simply make me choose the local or remote file to resolve the conflict. My question is "is this a git setting (if so, what?) or a BC setting?"

Andrew Bullock
  • 36,616
  • 34
  • 155
  • 231

2 Answers2

1

Beyond Compare doesn't support merging binary files. Some version control systems allow you to define different merge tools based on file extension, calling different merge tools for binary and text files. I don't think Git provides a way to do that.

You'll have to merge binary files outside of Beyond Compare.

To resolve the conflict with the repository version of the .dll file:

    git checkout --theirs -- file.dll
    git add file.dll
    git commit

To resolve the conflict with your version of the .dll file:

    git checkout --ours -- file.dll
    git add file.dll
    git commit

I'll add merge of binary files to our feature wish list for a future version of Beyond Compare.

Chris Kennedy
  • 2,639
  • 12
  • 11
  • Thanks, I don't _want_ to do a binary merge. Git used to ask me "do you want to use the local or remote file?" Not sure if ive changed a git setting or if its a difference between BC3 and 4. Sounds like Git... – Andrew Bullock May 06 '15 at 16:36
  • Beyond Compare has never prompted to select the local or remote file when merging, so this must be a change in Git's behavior if you updated versions of Git recently or a Git setting. – Chris Kennedy May 06 '15 at 18:19
0

This works better 6 years later: With Git 2.34 (Q4 2021), the xxdiff difftool (in your case 'BeyondCompare') backend can exit with status 128, which the difftool-helper that launches the backend takes as a significant failure, when it is not significant at all.
This is no longer blocking.

Here, 'xxdiff' is the diff tool of your choice (again, here, BeyondCompare)

See commit 571f434 (12 Oct 2021) by David Aguilar (davvid).
(Merged by Junio C Hamano -- gitster -- in commit 6a1bb08, 25 Oct 2021)

mergetools/xxdiff: prevent segfaults from stopping difftool

Signed-off-by: David Aguilar

Users often use "git difftool"(man) HEAD^" to review their work, and have "mergetool.prompt" set to false so that difftool does not prompt them before diffing each file.

This is very convenient because users can see all their diffs by reviewing the xxdiff windows one at a time.

A problem occurs when xxdiff encounters some binary files.
It can segfault and return exit code 128, which is special-cased by git-difftool-helper as being an extraordinary situation that aborts the process.

Suppress the exit code from xxdiff in its diff_cmd() implementation when we see exit code 128 so that the GIT_EXTERNAL_DIFF loop continues on uninterrupted to the next file rather than aborting when it encounters the first binary file.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250