Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » File diffs always show whitespace changes
File diffs always show whitespace changes [message #895758] Sun, 15 July 2012 19:43 Go to next message
Derek Battams is currently offline Derek Battams
Messages: 2
Registered: July 2012
Junior Member
Running EGit 2.0.0.201206130900-r/Eclipse 4.2 on Win7.

Anytime I diff a file within Eclipse against any version from my Git repository, the comparison always shows whitespace changes, even if I compare a freshly committed file against HEAD (which shouldn't show any differences). Yet, if I go to the command line and do a git-diff of my working copy against my repo then the diffs look as I'd expect (i.e. the tonnes of whitespace diffs aren't present). So it appears the diff being done by EGit is causing the issue. These whitespace diffs make it almost impossible to view file diffs as needed before committing. Is there some way to correct this?

Help appreciated.

index.php/fa/10712/0/

This screen is comparing a file to HEAD immediately after committing the file to my repo. I'd expect zero differences to be reported and if I run git-diff from the command line I do indeed get zero differences, but EGit is showing all of these whitespace differences.

[Updated on: Sun, 15 July 2012 19:48]

Report message to a moderator

Re: File diffs always show whitespace changes [message #895766 is a reply to message #895758] Sun, 15 July 2012 21:03 Go to previous messageGo to next message
Robin Rosenberg is currently offline Robin Rosenberg
Messages: 324
Registered: July 2009
Senior Member
Derek Battams skrev 2012-07-15 21.43:
> Running EGit 2.0.0.201206130900-r/Eclipse 4.2 on Win7.
>
> Anytime I diff a file within Eclipse against any version from my Git repository, the comparison always shows whitespace changes, even if I compare a freshly committed file against HEAD (which shouldn't show any differences). Yet, if I go to the command line and do a git-diff of my working copy against my repo then the diffs look as I'd expect (i.e. the tonnes of whitespace diffs aren't present). So it appears the diff being done by EGit is causing the issue. Is there some way to correct this?

For now you can ignore whitespace differences with Eclipse settings under Compare/Patch.

-- robin
Re: File diffs always show whitespace changes [message #895775 is a reply to message #895766] Mon, 16 July 2012 00:03 Go to previous messageGo to next message
Derek Battams is currently offline Derek Battams
Messages: 2
Registered: July 2012
Junior Member
That did it. Thanks! Is there a reason why that setting change is required with Git, but wasn't when I was using SVN?
Re: File diffs always show whitespace changes [message #895797 is a reply to message #895775] Mon, 16 July 2012 06:00 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26047
Registered: July 2009
Senior Member
My impression is that EGit, despite line-ending conversion being a
fundamental long standing issue for which there remain open bug reports,
continues to mishandle the autocrlf setting. In particular, my
impression is that on Windows when you modify a file, the copy that's
stored in the index is changed to use Unix-style line endings while the
workspace copy keeps the line settings the resource already has. It's
endless frustrating. As far as I understand, the platform team mostly
avoids the issue by changing the workspace preferences to use Unix-style
line endings.

The question remains: How can something as fundamental to version
management as the proper handling of different line feed conventions on
different platforms remain an issue for years?


On 16/07/2012 2:03 AM, Derek Battams wrote:
> That did it. Thanks! Is there a reason why that setting change is
> required with Git, but wasn't when I was using SVN?
Re: File diffs always show whitespace changes [message #899896 is a reply to message #895797] Thu, 02 August 2012 18:00 Go to previous messageGo to next message
Mark Mikofski is currently offline Mark Mikofski
Messages: 3
Registered: August 2012
Junior Member
I came to the same conclusion as Ed Merks. It took me a while to realize that it wasn't just showing me whitespace, but it was showing the entire file as one be change, and what would do that? Well the obvious answer was line-endings. I was able to confirm it by comparing my local version with the "local history" - correctly shows changes, then compare two commits, also works correctly, but anytime you compare a local file to a git file, you get one giant change, which is a unfortunately useless. This is evidently addressed in Bug 361503 which, I believe, is the right approach - just include an option to ignore line-endings in diffs in the comparison editor. My suggestion to everyone in this post is to follow the link to this "bug" and vote for it so that this option gets changed. You will need to login.
Re: File diffs always show whitespace changes [message #899902 is a reply to message #899896] Thu, 02 August 2012 18:28 Go to previous message
Mark Mikofski is currently offline Mark Mikofski
Messages: 3
Registered: August 2012
Junior Member
FYI: There is a workaround, as suggested in message #895766. Unless you absolutely mustsee the whitespace, checking Ignore white space in under windows | preferences | General | Compare/Patch also ignores line-endings, therefore fixing the problem!

[Updated on: Thu, 02 August 2012 18:28]

Report message to a moderator

Previous Topic:Add Existing Local Repository programmatically
Next Topic:Indexed changes in origin after push
Goto Forum:
  


Current Time: Tue Sep 16 21:33:15 GMT 2014

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

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