Hello all,
I did some check-ups on git-svn, and actually there is no bug. Consider
the following repos:
Filename SVN Property Actual eol style
----------------------------------------------------------------
explicit-crlf.txt svn:eol-style=CRLF CRLF
explicit-lf.txt svn:eol-style=LF LF
implicit-crlf.txt (no prop) CRLF
implicit-lf.txt (no prop) LF
native.txt svn:eol-style=native CRLF/LF (CRLF for me)
I fetched this repository using git svn and then inspected the contents
of the checked out files, as well as what git status said.
As previously reported, the CRLF files, explicit-crlf.txt and
implicit-crlf.txt had "changes" (even from a clean checkout). However,
what I found interesting was the LF file, as well as the native file
(SVN equivalent of core.autocrlf).
I think this is proper behavior, and is identical behavior to Unix
systems. A bug would have been if native had been converted to CRLF, but
the internal repository format of those files is LF, which prevents
problems with core.autocrlf.
What is happening with the CRLF files is that they are being transferred
from Subversion to Git as CRLF, and thus are represented inside the Git
repository as CRLF. There is no way to losslessly checkout these files
with core.autocrlf on (as we will see later, there is a workaround),
because when Git commits them, it removes the CRLF and replaces it with
LF. Thus the errors.
For text files, I would argue that this is the *correct* behavior. They
should not have CRLF inside the repository, instead, Git, on checkout,
should convert if the platform is Windows. For files that must always be
CRLF, such as *.bat files, gitattributes can be used to set autocrlf on
a file-by-file (or, more probably, a glob-by-glob) for these files.
However, anything else should be stored as LF.
In short, I think it's a problem with improper line-endings in the
Subversion repository, and Git's just cleaning things up. There is no bug.
That being said, I do believe there are obvious areas we can improve.
However, the most important right now is informing users about the way
git-svn handles SVN repositories with CRLF files in them, and why they
need to either:
1. Make a mass commit for CRLF -> LF
2. Turn off core.autocrlf
3. Set all files that have problems to crlf=true with gitattributes
One last note; git gui and gitk seem to be a little flaky when it comes
to CRLF; I frequently have git and these tools disagreeing about the
working copy state. Further investigation is necessary.
Cheers,
Edward