Bug 440044

Summary: Egit problem in binary files with conflicts after Pull
Product: [Technology] EGit Reporter: Oscar Ortiz <abcoskar>
Component: CoreAssignee: Project Inbox <egit.core-inbox>
Status: NEW --- QA Contact:
Severity: major    
Priority: P3 CC: abcoskar, christian.halstrick, gro.espilce, matthias.sohn, robin, thomas
Version: 3.4Keywords: consistency
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Screenshots
none
Replace with Commit is disabled
none
eclipse-bug-440044-work-around-using-external-run-configuration none

Description Oscar Ortiz CLA 2014-07-21 16:13:32 EDT
Created attachment 245245 [details]
Screenshots

When I have a conflict in a binary file, after the pull EGit damage the file.
Comment 1 Oscar Ortiz CLA 2014-07-21 16:15:07 EDT
In command line it's possible to use git checkout --out or --theirs Egit doesn't have this utility.
Comment 2 Robin Stocker CLA 2014-07-22 01:13:53 EDT
(In reply to Oscar Ortiz from comment #1)
> In command line it's possible to use git checkout --out or --theirs Egit
> doesn't have this utility.

See bug 347835 for that.
Comment 3 Matthias Sohn CLA 2014-07-22 03:20:21 EDT
Does the file which gets damaged contain a null byte in the first 8k bytes ?

JGit doesn't yet support git attributes which are usually used to configure files which should be considered to be binary. Until git attributes are available JGit only can use a heuristic check: if a null byte is found in the first 8k bytes it considers a file to be binary. When this check fails but the file is binary anyway it may damage the file by using the line based merge algorithm.
Comment 4 Oscar Ortiz CLA 2014-07-22 10:00:03 EDT
Created attachment 245268 [details]
Replace with Commit is disabled

These are the first lines that show vi en binary mode:
0000000: 524f 532e 3630 3035 3000 0000 0000 000a  ROS.60050.......
0000010: 0000 00af 0012 a000 ffff ffff 1000 7202  ..............r.

With command line or source tree we don't have this problem with the binaries.
We want to use the plugin, recently we have migrated to Git, and we want to avoid the use of the command line and the plugin at the same time. 

Another problem is the Replace with -> commit, in conflicting state is disabled.
Comment 5 Mykola Nikishov CLA 2015-06-30 15:54:25 EDT
[Batch change] Remove pre-3.7 Target Milestones

If anyone on CC list is going to fix/implement this, please assign a new 3.7+ target milestone.
Comment 6 Matthias Sohn CLA 2015-07-05 05:40:04 EDT
looks like a bug in JGit, the file clearly contains null bytes in the beginning so JGit should not touch it during merge
Comment 7 Christian Halstrick CLA 2015-07-06 03:38:54 EDT
Is the repo public? Can we have a look at it? If not, is at least the file which get corrupted a file you can share?
Comment 8 Daniel Sokolowski CLA 2016-06-20 16:29:04 EDT
(In reply to Oscar Ortiz from comment #1)
> In command line it's possible to use git checkout --out or --theirs Egit
> doesn't have this utility.

Yes, please add 'Add to index theirs/ours' below the option to lunch the 'Merge tool'. For now as a work around I have created an external run configuration (see `eclipse-bug-440044-work-around-using-external-run-configuration.png` attachment)
Comment 9 Daniel Sokolowski CLA 2016-06-20 16:29:52 EDT
Created attachment 262547 [details]
eclipse-bug-440044-work-around-using-external-run-configuration
Comment 10 Daniel Sokolowski CLA 2016-06-21 09:10:26 EDT
(In reply to Oscar Ortiz from comment #4)
...
> Another problem is the Replace with -> commit, in conflicting state is
> disabled.

Yes, this is another good way to handle binary file conflicts. I naturally tried this approach first but that option is disabled as stated.