Thread (33 messages) 33 messages, 13 authors, 2016-08-11

Re: CRLF problems with Git on Win32

From: Peter Klavins <hidden>
Date: 2016-06-15 22:44:02

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 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help