Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » Behavior divergence between Git and JGit on binary merge
Behavior divergence between Git and JGit on binary merge [message #1764548] Wed, 31 May 2017 03:47 Go to next message
Eclipse UserFriend
Hello JGit committers,

I was doing some tests with the merge of conflicting binary files and ran into a divergence of behavior between Git and JGit. I would like to know if this is something wanted or an issue.

In Git (version 2.11.0 packaged with Xcode on a Mac), when I merge try to merge two different version of an image (png), I stop on a conflit and before doing anything else, I am still able to open the file in an Eclipse editor. The result displayed is the local version of the image (before the conflict).

With JGit on the other hand, the image is corrupted until I use the merge tool to choose a version or the other.

I think the issue comes from the fact that JGit handle binary files like textual ones : it try to merge the file and then write the conflicting result to let the user choose what to do (ResolveMerger.updateIndex).
When trying to merge the file, JGit add conflicts metadata in the file even if it is a binary one (MergeFormatterPass.writeConflictMetadata). This result to a corrupted file containing conflicting binary parts.
Is this a known or wanted behavior?

To reproduce:
- import the given project into Eclipse
- checkout the branch smiling and merge with the branch sad using JGit.
- verify that if you double click on the file smiley.png, the editor cannot open it.
- reset the branch smiling
- use Git to merge with the branch sad
- double click on the file smiley.png in Eclipse and verify that the editor can open it

Best regards,

Mathieu
  • Attachment: smiley.zip
    (Size: 84.57KB, Downloaded 157 times)

[Updated on: Wed, 31 May 2017 08:50] by Moderator

Re: Behavior divergence between Git and JGit on binary merge [message #1764552 is a reply to message #1764548] Wed, 31 May 2017 04:05 Go to previous messageGo to next message
Eclipse UserFriend
of course this is not the expected behaviour. Also JGit should detect that file content is binary and not try to merge these contents. I'll have a look
Re: Behavior divergence between Git and JGit on binary merge [message #1767197 is a reply to message #1764552] Mon, 03 July 2017 09:15 Go to previous messageGo to next message
Eclipse UserFriend
Will https://git.eclipse.org/r/#/c/99874/ help here? If yes then this could be closed.
Re: Behavior divergence between Git and JGit on binary merge [message #1767445 is a reply to message #1767197] Thu, 06 July 2017 03:56 Go to previous messageGo to next message
Eclipse UserFriend
No it doesn't fix the issue: it comes from the merge of files detected as binary by JGit and the patchset is only about handling the -merge gitattribute
Re: Behavior divergence between Git and JGit on binary merge [message #1767450 is a reply to message #1767445] Thu, 06 July 2017 04:23 Go to previous message
Eclipse UserFriend
Right. But it's related, or? If JGit detects a file as binary shouldn't it assume -merge, -diff, -text attributes.
Previous Topic:Porject directory stucture wierdness
Next Topic:which git binary does EGit use
Goto Forum:
  


Current Time: Fri Jul 04 21:35:02 EDT 2025

Powered by FUDForum. Page generated in 0.04558 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top