Hi guys,

while checking out the Issue 59 ([1]) and its Pull Request [2] something
came to my attention. In that pull request are two files that have
literally been completely rewritten due to a change in the lineendings thus
making it very difficult to discern what has changed in them.

In the wiki at netbeans.org there's a page [3] essentially explaining how
to work with the sources ( under version control. The DVCS there is
Mercurial and the page contained a quick intro into how to work with
Mercurial and how to configure it. The configurations also contained auto
correction of lineendings and settings of usernames, emails, plugins, etc..

Now I'm not saying we should create such a page as well, even though it may
prove prudent to do so. What was good about that page is that it ensured
that the effect described above did not happen very often.

Hopefully there's a precedent within other Apache projects on how to handle
this.
However if there's not a litte investingation shows to two options we can
take to ensure "proper" lineending. [4] describes both of those options.

The first is that [git config core.autocrlf command is used to change how
Git handles line endings. It takes a single argument]. Optionally with the
--global parameter. This is a setting every commiter has to configure
themselves.

The other is that [you can configure the way Git manages line endings on a
per-repository basis by configuring a special *.gitattributes* file. This
file is committed into the repository and overrides an individual's
core.autocrlf setting, ensuring consistent behavior for all users,
regardless of their Git settings. The advantage of a *.gitattributes* file
is that your line configurations are associated with your repository. You
don't need to worry about whether or not collaborators have the same line
ending settings that you do.]

One word of caution for the .gitattributes solution is that certain tools
such as Egit or JGit will ignore .gitattribute files (see [5])


Ultimately there are two questions.

1. Do we care if files get reformatted because they were edited on
different OSs due to differint lineendings?

2. If so, what are we going to do to prevent that from happening?

Regards
Martin

[1] https://issues.apache.org/jira/browse/NETBEANS-59
[2] https://github.com/apache/incubator-netbeans/pull/1
[3] http://wiki.netbeans.org/HgHowTos#Configuring_Mercurial
[4] https://help.github.com/articles/dealing-with-line-endings/#platform-all
[5] https://bugs.eclipse.org/bugs/show_bug.cgi?id=342372

Reply via email to