eclipsegiteditorcompare

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!


Solution

  • Note 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 EOLs 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.


    Eclipse 4.29 (Q3 2023) adds:

    Improved "Ignore Whitespace" in Java Compare

    Up to now the "Ignore White Space" context menu action in the Java Compare editor ignored all whitespace, including what may be semantically significant whitespace.

    Showing all white space changed -- https://eclipse.dev/eclipse/news/4.29/images/show_ws.png

    For example, a white space difference in a Java string literal is semantically significant while trailing white space is not.

    This has now been inproved so that e.g. white space changes in string literals are also shown while "Ignore White Space" is active.

    Hiding insignificant white space -- https://eclipse.dev/eclipse/news/4.29/images/ignore_ws.png