Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 07:47 Go to next message
Mathieu Cartaud is currently offline Mathieu CartaudFriend
Messages: 4
Registered: April 2016
Junior Member
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 119 times)

[Updated on: Wed, 31 May 2017 12:50]

Report message to a moderator

Re: Behavior divergence between Git and JGit on binary merge [message #1764552 is a reply to message #1764548] Wed, 31 May 2017 08:05 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 274
Registered: July 2009
Senior Member
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

Ciao
Chris
Re: Behavior divergence between Git and JGit on binary merge [message #1767197 is a reply to message #1764552] Mon, 03 July 2017 13:15 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 274
Registered: July 2009
Senior Member
Will https://git.eclipse.org/r/#/c/99874/ help here? If yes then this could be closed.

Ciao
Chris
Re: Behavior divergence between Git and JGit on binary merge [message #1767445 is a reply to message #1767197] Thu, 06 July 2017 07:56 Go to previous messageGo to next message
Mathieu Cartaud is currently offline Mathieu CartaudFriend
Messages: 4
Registered: April 2016
Junior Member
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 08:23 Go to previous message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 274
Registered: July 2009
Senior Member
Right. But it's related, or? If JGit detects a file as binary shouldn't it assume -merge, -diff, -text attributes.

Ciao
Chris
Previous Topic:Porject directory stucture wierdness
Next Topic:which git binary does EGit use
Goto Forum:
  


Current Time: Thu Apr 25 09:35:31 GMT 2024

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

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

Back to the top