eclipse-jgit/jgit

Binary Conflict file is empty (0 byte file).

Closed this issue · 10 comments

Version

6.6.0

Operating System

Windows

Bug description

We try merge the git workspace. If it has conflict binary files, it makes 0 byte file. The same case when we do it using git command, the binary file has maintain the content as local version and marked the file as conflict. We expect the same behavior in JGit API also.

Actual behavior

Binary conflicted files(example jpeg file conflict) are empty after merge with JGit API. This makes issue, user does not know the actual content of the file and they cannot open the file in corresponding tools.

Expected behavior

The same above case, if I perform the merge using git command, the file content remains as local version content. It marked the file as conflict. Hence user can open the file and see the content and resolve the conflict manually.

We expect the same git command behavior in JGit merge API.

2024-01-11 13_57_02-Clipboard
image-2024-01-03-13-19-45-081

Relevant log output

No response

Other information

No response

Does this also occur with the latest JGit 6.8.0?

Yes.. it occurs in 6.8.0.202311291450-r also.

I think, I can work on this issue. I have gone through the code and got some insights on what's going wrong. Can I get this issue assigned to me, please

In the class ResolveMerger.java, we are trying to create a RawText MergeResult in the method contentMerge. But for binary files, this method would throw BinaryBlobException which implies that the MergeResult has no chunks. Even with no chunks, we are trying to create a new OutputStream to file in workTreeUpdater.updateFileWithContent method which is making our file empty

Hi
Link for gerrit review: https://review.gerrithub.io/c/eclipse-jgit/jgit/+/1176055

Please go through and give your suggestions

Link for the gerrit review: https://review.gerrithub.io/c/eclipse-jgit/jgit/+/1176833

Please go through it @tomaswolf

Hi @tomaswolf
Updated the gerrit review. Please go through it

You don't need to ping me here. I get e-mails from gerrit anyway.

Hi @msohn
Can you please review the following gerrit review and help me with your feedback

https://review.gerrithub.io/c/eclipse-jgit/jgit/+/1176833

merged as 567315a