Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse compare editor stopped showing detailed differences

I've been using eclipse for java android development for 6 months and I love the compare editor. In the last few days I have been hacking away and I think I have all my git ducks in a row, or close enough that things are clean and neat and I can find old working versions of apps.

But it seems in the last day or two, the eclipse compare editor has stopped showing diffs! i right click on uncommitted PlayThread.java and choose to compare with Commit... or HEAD or branch or anything, and no matter how similar the files might be, the compare editor shows one big white bar on its right side, and clicking to go to the next difference highlights the whole file!

I have looked through the git and compare preferences on eclipse and can't find anything that might help.

Any help getting my beautiful compare editor working for me again would be greatly appreciated!

like image 795
mwengler Avatar asked May 05 '12 00:05

mwengler


People also ask

How can I find the difference between two files in eclipse?

To compare two files in Eclipse, first select them in the Project Explorer / Package Explorer / Navigator with control-click. Now right-click on one of the files, and the following context menu will appear. Select Compare With / Each Other.

How do you enable compare with each other in eclipse?

To compare two files, highlight them in a view such as the Package Explorer and select Compare With→ Each Other in the view's context menu.

What is the compare editor used for?

You can view the differences between two resources by comparing them. You can compare the design of all the entity types, or the source code of Macros. You can compare two versions of the same instance, or two instances.


3 Answers

Note the the latest EGit 5.3.0 (Feb. 2020, 8 years later) improves the right side of the compare editor, using the Eclipse -> Preferences -> Text Editors -> Show whitespace characters mentioned in Vivek's answer.

Text comparisons in Eclipse have been improved to make "Show Whitespace" work in more cases.

Also, concurrent editing of a file in a merge editor and in another editor open on the same file has been improved and works now better and even for files not in the Eclipse workspace.

https://wiki.eclipse.org/images/a/aa/EGit_Compare_Editor_Show_Whitespace.png -- Screenshot of a Java comparison in Eclipse (workspace against index) showing whitespace on the index side

Note that both showing whitespace and concurrent editing depend not only on the way EGit sets up the comparison (which is what we improved) but also on the actual editors being used. These editors are beyond the control of EGit.

With files not in the Eclipse workspace, one may encounter Platform bug 214351 when a file is open in another editor.


Original answer (May 2012):

The compare editor shows one big white bar on its right side,

That means Egit considers the local content of that file (on your disk) differs completely from what have been committed.
The one classic case where that happens is for automatic eol conversion (Windows <=> Unix), which is why I always set core.autocrlf to false.
See "Git beta on Windows (msysgit) - Unix or DOS line termination".
See also "Distributing git configuration with the code" for managing those eol through .gitattribute file (except EGit doesn't support yet .gitattribute file).


In this instance, the OP mwengler reports:

Well that was it.
The way I fixed it was in Eclipse > Window > Preferences > General > Compare/Patch > General on that page I checked "Ignore white space" and now the editor shows my diffs.
But I think I will turn off that autocrlf stuff, I don't think I'm using anything on windows that can't handle both flavors

See Egit bug 361503 which mentions that this "Ignore White Space" now also honors the core.autocrlf setting.


like image 147
VonC Avatar answered Oct 24 '22 03:10

VonC


With respect to Javascript compair showing nothing, there is a known bug.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=509820

Workaround...

  • Window >> Preferences >> General Tab >> Compare/Patch
  • Deselect checkbox next to "Open structure compare automatically"
like image 39
andrew pate Avatar answered Oct 24 '22 04:10

andrew pate


Below setting also works for Eclipse Oxygen Release.

It appears that this has something to do with the Structured Compare. To

use the simpler and apparently working version of compare choose:

  • Window > Preferences > General Tab > Compare/Patch
  • Deselect checkbox next to "Open structure compare automatically"

Enjoy text level diffing of ES6 classes.

Regards, Rasool Javeed Mohammad [email protected]

like image 2
M R Javeed Avatar answered Oct 24 '22 02:10

M R Javeed