Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How can I make Eclipse ignore EOL type in compares?
How can I make Eclipse ignore EOL type in compares? [message #639591] Wed, 17 November 2010 04:48 Go to next message
Peter Steele is currently offline Peter SteeleFriend
Messages: 45
Registered: November 2010
Member
I'm running Eclipse on a Windows box, accessing files on a drive that is mapped from a Linux box. Everything works fine doing this except for compares. Since Eclipse is running on Windows, it assumes CRLF for line ends. The files themselves though are housed on a Unix box and have LF line ends. As a result, the Eclipse "Compare with base revision" command thinks that every line has a change. If I do a diff using TortoiseSVN or run a "svn diff" from the command line, these operations ignore the line ends, which is what I want.

I've looked through all the various preferences screens in Eclipse to see if there is a way to make Eclipse behave this way but I cannot find anything. The closest was to make Eclipse ignore whitespace but that does more than I want. Is there anyway to make Eclipse ignore line ends when doing compares?
Re: How can I make Eclipse ignore EOL type in compares? [message #640276 is a reply to message #639591] Fri, 19 November 2010 21:12 Go to previous messageGo to next message
Peter Steele is currently offline Peter SteeleFriend
Messages: 45
Registered: November 2010
Member
Judging from the lack of response to this, I assume there is no way to configure Eclipse to make it ignore the end-of-line character during comparisons. This would definitely be a useful feature to have. Basically a variant of the ignore whitespace option, just a little more specific.
Re: How can I make Eclipse ignore EOL type in compares? [message #640280 is a reply to message #640276] Fri, 19 November 2010 21:25 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2010.11.19 14:12, Peter Steele wrote:
> Judging from the lack of response to this, I assume there is no way to
> configure Eclipse to make it ignore the end-of-line character during
> comparisons. This would definitely be a useful feature to have.
> Basically a variant of the ignore whitespace option, just a little more
> specific.


....or no one who has been afflicted with the problem and found a way
around it happens to have visited the newsgroup in the last few days.
Re: How can I make Eclipse ignore EOL type in compares? [message #640285 is a reply to message #640280] Fri, 19 November 2010 23:18 Go to previous messageGo to next message
Peter Steele is currently offline Peter SteeleFriend
Messages: 45
Registered: November 2010
Member
Yeah, or that...

Confused

It's been annoying me for three years. Wish I knew a solution.

Re: How can I make Eclipse ignore EOL type in compares? [message #640310 is a reply to message #640285] Sat, 20 November 2010 09:22 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Peter Steele wrote:
> Yeah, or that...
>
> :?
> It's been annoying me for three years. Wish I knew a solution.
If the files are shared with CVS you should set the ascii keyword mode:
this causes line delimiters to be converted automatically to match your
platform default on check out .

Dani
Re: How can I make Eclipse ignore EOL type in compares? [message #640331 is a reply to message #640310] Sat, 20 November 2010 18:33 Go to previous messageGo to next message
Peter Steele is currently offline Peter SteeleFriend
Messages: 45
Registered: November 2010
Member
I'm using SVN. The issue is that the files are being checked out under Linux since that is where they are being compiled (gcc). I'm using Eclipse though on a Windows box with the files being accessed over a Samba share. All of the other SVN tools I use (e.g., TortoiseSVN) ignore line ends when doing comparisons. Eclipse does not for some reason.
Re: How can I make Eclipse ignore EOL type in compares? [message #714469 is a reply to message #640331] Wed, 10 August 2011 15:13 Go to previous messageGo to next message
M8R-fqo0di is currently offline M8R-fqo0diFriend
Messages: 1
Registered: August 2011
Junior Member
I have the exact same problem described by the original poster using CVS, and I'm also hoping it gets fixed in the foreseeable future, or a workaround is found for this.

A couple of comments to add to what was said above:

1. From what I've noticed, the files are saved from Eclipse (running on the Windows machine) through the samba drive on the Linux machine without the CR (e.g. only LF), which is the behavior I expect/want. However, when you try to compare the file to the CVS HEAD version in Eclipse, Eclipse seems to checks out the HEAD version with CR+LF ending each line, which is then compared to the local copy on the Windows having CRs only. This obviously produces diffs on all lines due to the extra CRs.

As the original poster noted, the only way to turn off this behavior seems to be to have the compare ignore whitespaces globally, which is not the desired behavior. The behavior I'd like to see is Eclipse being able to ignore only the CRs when it checks out a version from CVS for comparison.

2. Another related problem: in the project explorer, Eclipse shows differences on these files compared with the CVS repository (i.e. it preceeds their names with a ">" character), making it impossible to distinguish visually which files have actually been locally modified without checking each file independently. Checking these files manually using "Compare with -> Latest from HEAD" confirms that the differences are only in the extra CRs. The desired behavior is to have the Project Explorer automatically disregard CR-related differences when marking files as locally modified.

3. The files under the CVS directory (CVS/Root, CVS/Repository and CVS/Entries) are overwritten by Eclipse. The problem is they are written to the Linux filesystem through the samba mount using the originating OS's newline conventions, which is CRLF on Windows. This breaks down the command line CVS on the Linux since it can't handle the extra CRs, and requires their removal to work. I've written an alias to do just that, and have noticed many others on the web have done the same. I wonder whether there's a way to instruct Eclipse to never add these CRs, or to format the newlines according to the target platform where the CVS server resides rather than the source platform on which the Eclipse CVS client is run.

Thanks,
Ben


EDIT:
I seem to have found an option that resolves issue #1 above, by turning off the whitespace ignoring in compare and turning on instead:
Team -> CVS -> Files and Folders -> Uncheck "Convert text files to use platform line ending"

This worked for me (required restart of Eclipse to update).
I still don't have any solutions for issues #2 and #3. Any suggestion are welcome.

[Updated on: Thu, 11 August 2011 09:46]

Report message to a moderator

Re: How can I make Eclipse ignore EOL type in compares? [message #715772 is a reply to message #714469] Mon, 15 August 2011 13:32 Go to previous message
Peter Steele is currently offline Peter SteeleFriend
Messages: 45
Registered: November 2010
Member
The obvious addition needed to the Eclipse Compare/Patch page is the option "Ignore line ends". This would be a more precise version of the current "Ignore white space" option, targeting only line ends instead of all white space.

Previous Topic:Eclipse 4.1 Formatter Question
Next Topic:How to hide non-empty (default package)?
Goto Forum:
  


Current Time: Tue Sep 24 14:56:19 GMT 2024

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

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

Back to the top