[git-users] CRLF / LF

2012-11-23 Thread fpefpe
Hello -- I just download the latest tarball for emacs -- I  I  tried to 
compile it for win xp with and older msvc compiler, but there were 
errors  I then wanted to track my changes / fixes, so I created a GIT 
repo ... I have GIT installed on my XP  system as a stand-a-lone 
git env -- 

I did the git  int, then the git add and not sure if it was at this point 
or git commit were I got pages of message about LF / CRLF conversion --  is 
this going to cause emacs to break?  -- Is there a best-practice on how to 
handle source that are shared between windows and unix?  

-- 




Re: [git-users] CRLF / LF

2012-11-23 Thread Konstantin Khomoutov
On Fri, 23 Nov 2012 07:49:55 -0800 (PST)
fpefpe fpespos...@gmail.com wrote:

 Hello -- I just download the latest tarball for emacs -- I  I  tried
 to compile it for win xp with and older msvc compiler, but there were 
 errors  I then wanted to track my changes / fixes, so I created a
 GIT repo ... I have GIT installed on my XP  system as a stand-a-lone 
 git env -- 
 
 I did the git  int, then the git add and not sure if it was at this
 point or git commit were I got pages of message about LF / CRLF
 conversion --  is this going to cause emacs to break?  -- Is there a
 best-practice on how to handle source that are shared between windows
 and unix?

This depends on your setup.
When installing, the Git for Windows installer asks you what EOL
handling mode you wish to have as default (this affects the
system-level Git congfiguration, so you may override it on the user-
and repository-level).  By default, the installer offers you to set the
check in LFs, check out native mode, which corresponds to setting
the core.autocrlf configuration setting to true, and that's what
the installer does if you does not tick some other checkbox on that
settings page.

So supposedly those warning were all about the thing
that what's committed to the repository will have LFs while your local
files will have CRLFs.  If you do not like this behaviour (say, you
only intend to edit the sources using a text editor which is okay with
LFs on Windows and won't change them behind your back), just re-create
the repository, and before adding the files override that core.autocrlf
option by running something like

git config --add --local core.autocrlf false

You can then verify it works by doing

git config --list core.autocrlf

Adding the files after that should produce no warnings, and no EOL
conversion should be performed.

(You can run `git help config` to read up on the core.autocrlf and
friends.)

As to best practices, it's a tough topic.  Recently, in a thread
occured on the main Git list, Raja R Harinath referenced
the .gitattributes file used by the Mono project -- it's an interesting
reading which pretty much nails it all [1].

The default setting picked up by the Git for Windows developers appears
to be a good standard: the text files in *the repo* have normalized EOL
style (LFs), so exchanging commits between Windows and non-Windows
becomes smooth; for those files which *must* have CRLF, you can
use .gitattributes, to override the EOL conversion settings.

1. https://github.com/mono/mono/blob/master/.gitattributes

--