git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jens Lehmann <jens.lehmann@web.de>
Date
Jun 21, 2012, 19:06 UTC
Message-ID
<4FE370B4.60404@web.de>
In-Reply-To
<20120620191132.GB31520@sigill.intra.peff.net>
Am 20.06.2012 21:11, schrieb Jeff King:
Show 11 quoted lines
> 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.

Show 5 quoted lines
> 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)

Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 12 in “submodule add + autocrlf + safecrlf”
  1. 0/2 submodule add + autocrlf + safecrlfBrad King, Jun 20, 2012
  2. 1/2 submodule: Demonstrate failure to add with auto/safecrlfBrad King, Jun 20, 2012
  3. 2/2 submodule: Tolerate auto/safecrlf when adding .gitmodulesBrad King, Jun 20, 2012
  4. Jens LehmannJun 20, 2012
  5. Brad KingJun 20, 2012
  6. Jens LehmannJun 20, 2012
  7. Jeff KingJun 20, 2012
  8. Junio C HamanoJun 20, 2012
  9. Jens LehmannJun 21, 2012
  10. Junio C HamanoJun 20, 2012
  11. Brad KingJun 20, 2012
  12. Junio C HamanoJun 20, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.