On Jan 7, 2008, at 11:13 AM, Peter Klavins wrote:
I use an alternate workaround that clones the repository, removes
the checked out files, sets autocrlf, then checks out the files again:
$ git clone git://git.debian.org/git/turqstat/turqstat.git
$ cd turqstat
$ git config --add core.autocrlf true
$ rm -rf * .gitignore
$ git reset --hard
The result should now be the same as using Steffen's system.
Yes, this should yield the same.
However, there is still an unresolved problem with git's way of
treating cr/lf as an attribute only of the checkout and not the
repository itself:
$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# modified: visualc/.gitignore
# modified: visualc/turqstat.sln
# modified: visualc/turqstat.vcproj
#
no changes added to commit (use "git add" and/or "git commit -a")
So, checking out the repository with cr/lf true has now caused
misalignment of files that were originally checked in with existing
cr/lf's in place. Visual Studio in fact happily works with files
that only have lf endings, _except_ *.sln and *.vcproj files, which
it much prefers to have with cr/lf endings.
You could try .gitattributes to exclude files from crlf
conversion. But I'd not recommend this, because the mechanism
has some deficiencies, as discussed in
http://thread.gmane.org/gmane.comp.version-control.git/61888
The _real_ solution to this problem for the moment is _not_ to mix
files with both lf and cr/lf endings in the repository.
This is the way to go.
So, the original author of the repository should _also_ have used
core.autocrlf true, thus causing the *sln and *vcproj to have their
cr's stripped on checkin, but replaced on checkout when checking
out with autocrlf true.
For cross-platform projects, I recommend to explicitly configure
autocrlf on Windows and Unix. On Windows set
git config core.autocrlf true # on Windows
and on Unix set
git config core.autocrlf input # on Unix
This ensures that the repository only contains LF. Even if someone
emails source code from Windows to Unix and commits it there.
Steffen
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html