You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by Pascal Schumacher <pa...@gmx.net> on 2016/01/15 19:57:19 UTC

Normalize line endings?

Hello everybody,

should the line endings of all source files in git be normalized to "\n"?

see the discussion at https://github.com/apache/groovy/pull/236

-Pascal


Re: Normalize line endings?

Posted by Russel Winder <ru...@winder.org.uk>.
On Fri, 2016-01-15 at 23:47 +0100, Jochen Theodorou wrote:
> 
[…]
> I am working on Groovy for several years now, and 90% of the time,
> this 
> was on a linux system. Still I have seen new files from me with \r\n 
> line endings. I do not really know why that is. I would be all for
> the 

Someone used a Windows machine to commit (many) files which have \r\n
line endings. Linux person checks the files out, they have \r\n line
endings.

This has been a ####### pain for me for years, so much so I stopped
even looking at the Groovy source code with a view to editing it.

> feature, if it would mean to force it for new files.... From a few I 
> know they have been from having to do work on a laptop, and those
> stupid 
> things run so bad with linux all the time.... my current one is such
> a 
> good example for this... well... I am going off track here

Most of your problems are likely related to which editor you are using.
Emacs does at least recognize DOS line endings and work accordingly.

The core difficulty is that some files have \n line endings and other
have \r\n line endings. To me, this is an unacceptable state of
affairs. Given this is a Git repository, all line endings in all files
should be \n. No ifs, no buts, no mewling from Windows people, no
worrying about changing 400 files and the gross silliness of the
resultant commit logs.

> if two more people say they prefer forcing this line ending and 
> producing a gigantic commit, to overwrite hundreds of files (with
> ignore 
> whitespace you can at least make sure there is no new logic).... then
> I 
> will give up my position.

I think you should. Consistency of the repository far outweighs any
stupidness of a monster line endings commit. Currently some files have
\n and others \r\n, this means the repository is broken.

No pull request with \r\n line endings should be acceptable. No commits
from committers with \r\n line endings should be acceptable.

Windows users need to read about and act upon the git property
core.autocrlf before cloning the Groovy (or in fact any Git)
repository, and most especially before making a pull request or
pushing.

I have just had to deal with this with another Git repository and a
Mercurial one…


-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


Re: Normalize line endings?

Posted by Jochen Theodorou <bl...@gmx.org>.
On 15.01.2016 22:41, Konstantin Boudnik wrote:
> On Fri, Jan 15, 2016 at 07:20PM, Russel Winder wrote:
>> On Fri, 2016-01-15 at 19:57 +0100, Pascal Schumacher wrote:
>>> Hello everybody,
>>>
>>> should the line endings of all source files in git be normalized to
>>> "\n"?
>>>
>>> see the discussion at https://github.com/apache/groovy/pull/236
>>>
>>
>> The answer to this has always been yes. Git strategy has always been
>> that Windows people should use the mapping capability in Git. Sadly not
>> everyone has always heeded this and there are large number of \r\n line
>> endings committed into the repository. This is wrong. No ifs, no buts.
>
> I'd say the issue is even deeper: sadly some are still using systems with
> \r\n line endings ;)

I am working on Groovy for several years now, and 90% of the time, this 
was on a linux system. Still I have seen new files from me with \r\n 
line endings. I do not really know why that is. I would be all for the 
feature, if it would mean to force it for new files.... From a few I 
know they have been from having to do work on a laptop, and those stupid 
things run so bad with linux all the time.... my current one is such a 
good example for this... well... I am going off track here

if two more people say they prefer forcing this line ending and 
producing a gigantic commit, to overwrite hundreds of files (with ignore 
whitespace you can at least make sure there is no new logic).... then I 
will give up my position.

bye Jochen


Re: Normalize line endings?

Posted by Konstantin Boudnik <co...@apache.org>.
On Fri, Jan 15, 2016 at 07:20PM, Russel Winder wrote:
> On Fri, 2016-01-15 at 19:57 +0100, Pascal Schumacher wrote:
> > Hello everybody,
> > 
> > should the line endings of all source files in git be normalized to
> > "\n"?
> > 
> > see the discussion at https://github.com/apache/groovy/pull/236
> > 
> 
> The answer to this has always been yes. Git strategy has always been
> that Windows people should use the mapping capability in Git. Sadly not
> everyone has always heeded this and there are large number of \r\n line
> endings committed into the repository. This is wrong. No ifs, no buts.

I'd say the issue is even deeper: sadly some are still using systems with
\r\n line endings ;)

Cos

Re: Normalize line endings?

Posted by Russel Winder <ru...@winder.org.uk>.
On Fri, 2016-01-15 at 19:57 +0100, Pascal Schumacher wrote:
> Hello everybody,
> 
> should the line endings of all source files in git be normalized to
> "\n"?
> 
> see the discussion at https://github.com/apache/groovy/pull/236
> 

The answer to this has always been yes. Git strategy has always been
that Windows people should use the mapping capability in Git. Sadly not
everyone has always heeded this and there are large number of \r\n line
endings committed into the repository. This is wrong. No ifs, no buts.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder