Re: CRLF problems with Git on Win32
- From
Peter Klavins <klavins@netspace.net.au>
- Date
- Jan 7, 2008, 10:13 UTC
- Message-ID
- <flsu0r$m9p$1@ger.gmane.org>
- In-Reply-To
- <5C0F88FD-AB2F-4BAD-ADEC-75428F14260F@zib.de>
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.
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.
The _real_ solution to this problem for the moment is _not_ to mix files with both lf and cr/lf endings in the repository.
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.
------------------------------------------------------------------------ Peter Klavins