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

Re: [PATCH 1/2] attr: fix attribute handling if .gitattributes is involved

From
Brian Downing <bdowning@lavos.net>
Date
Aug 13, 2007, 01:51 UTC
Message-ID
<20070813015115.GI21692@lavos.net>
In-Reply-To
<11869508753328-git-send-email-prohaska@zib.de>
On Sun, Aug 12, 2007 at 10:34:34PM +0200, Steffen Prohaska wrote:
Show 11 quoted lines
> This together with the patch that follows fixes a problem, which
> is most likely to bite Windows users. I recognized it by setting
> autocrlf globally to true and doing a fresh checkout of msysgit.
> The checkout contained etc/termcap converted to CRLF, although
> is was marked as '-crlf' in etc/.gitattributes.
> 
> If we believe autocrlf is a reasonable default for Windows users,
> we really should use it ourselves, to find such problems. 
> 
> The fixed problem is not really critical but may be quite annoying,
> and complex to understand.
I have a case in a live repository where this is not merely annoying.

I have a test data in one of my repositories that must never be converted. It has a mix of Unix and Windows line-endings in it. I marked the appropriate files with the "-crlf" attribute.

With the current git behavior, cloning this repository with "autocrlf" globally set irreversably corrupts the files (converting the LF line-enders to CRLF) on checkout. If the user is careless upon commit, these corrupted files will then be committed back (probably with all CRLFs, since at that point the .gitattributes is present and the -crlf attribute will be honored.)

There is kind of an ugly chicken-and-egg problem here, but I think it would be good to figure it out to avoid this kind of broken behavior.

I would also vote for this handling to be in the plumbing, since the autocrlf processing is in the plumbing as well.

Another thing to consider with respect to attribute access -- It would be nice for git-cvsserver to be able to send the correct -k option to the remote side for line endings. Doing this correctly involves accessing attributes, but git-cvsserver never has a full working directory. Having the attribute machinery work without a working directory (either directly from trees or from an index) would be a great benefit here.

-bcd
Previous: Junio C Hamano
Message 20 of 20 in “attr: fix attribute handling if .gitattributes is involved”
  1. 1/2 attr: fix attribute handling if .gitattributes is involvedSteffen Prohaska, Aug 12, 2007
  2. 2/2 checkout: fix attribute handling in checkout allSteffen Prohaska, Aug 12, 2007
  3. Junio C HamanoAug 12, 2007
  4. Steffen ProhaskaAug 12, 2007
  5. Junio C HamanoAug 13, 2007
  6. Marius Storm-OlsenAug 13, 2007
  7. Steffen ProhaskaAug 13, 2007
  8. Marius Storm-OlsenAug 13, 2007
  9. Steffen ProhaskaAug 13, 2007
  10. Marius Storm-OlsenAug 13, 2007
  11. Steffen ProhaskaAug 13, 2007
  12. Dmitry KakurinAug 13, 2007
  13. 1/2 attr.c: refactoringJunio C Hamano, Aug 14, 2007
  14. 2/2 attr.c: read .gitattributes from index as well.Junio C Hamano, Aug 14, 2007
  15. Steffen ProhaskaAug 13, 2007
  16. Johannes SchindelinAug 13, 2007
  17. David KastrupAug 13, 2007
  18. git-update-ref bug? (was: [PATCH 2/2] checkout: fix attribute handling in checkout all)David Kastrup, Aug 13, 2007
  19. Junio C HamanoAug 13, 2007
  20. Brian DowningAug 13, 2007

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.