Subject: Re: [PATCH 2/2] submodule: Tolerate auto/safecrlf when adding .gitmodules

From: Jens Lehmann <[email-masked]>
Date: Thu, 21 Jun 2012 21:06:28 +0200

Am 20.06.2012 21:11, schrieb Jeff King:
> The only sane thing is to have a canonical in-repo representation.
> Fortunately we already have the infrastructure for that, and in theory
> it should be as easy as adding ".gitmodules text" to our built-in
> gitattributes (you could even do "eol=lf", but I don't see a reason not
> to respect the native line endings in the working tree, given that git
> can handle the CRLFs just fine).
> 
> I say "in theory" there because I am not sure whether specifying a file
> as definitely text via attributes will actually suppress the safecrlf
> check or not. IMHO, it should, since safecrlf is really about preventing
> false positives via autocrlf or text=auto.

A quick test shows that unfortunately theory differs from practice here.
Adding ".gitmodules text" to the built-in gitattributes lets the test
Brad wrote still fail. You have to use ".gitmodules eol=lf" to make it
pass. I stopped digging deeper at this point.

> I don't see any reason for each individual repo to have to add these
> attributes manually. This is a git-specific file, and the format is
> dictated by git. We know that it's a text file, so why not help out the
> user? We should possibly do the same thing for .gitattributes and
> .gitignore.

I really like this approach. (And in the long run would like to see a
ini-file aware merge driver being used for the .gitmodules file too,
which would just merge submodules added in different branches instead
of producing a conflict)