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

Re: Honoring a checked out gitattributes file

From
KAKristian Amlie <kristian.amlie@trolltech.com>
Date
Jan 28, 2009, 17:25 UTC
Message-ID
<498094F9.5070201@trolltech.com>
In-Reply-To
<49808B53.6040907@drmicha.warpmail.net>
Michael J Gruber wrote:
Show 21 quoted lines
> I think there's a general time ordering problem. Say you do the
> following commits:
> 
> A: add a.txt
> B: add a .gitattributes file covering *.txt (say with crlf or any filter)
> C: add c.txt
> 
> Now, with an empty dir, you do either
> 
> 1) checkout A, B, C sequentially
> 2) checkout C
> 
> The contents of the checkout will be different in cases 1) and 2):
> 1) a.txt is checked out out as is, c.txt according to the attributes
> 2) with current git: probably like 1), with your suggestion: both a.txt
> and c.txt filtered according to the attributes.
> 
> If you add a file and .gitattributes covering it in the same commit
> there is an ordering ambiguity which can be solved (patched away)
> easily, but I think the difference between 1) and 2) is still
> problematic, and would need to be dealt with.
I agree.
Show 5 quoted lines
> 
> The main problem seems to be that changing a file like gitattributes can
> potentially change (by changing filters) the contents which should be
> stored for a different file even if the checkout of that file doesn't
> change.

Yes, that is a problem. Ideally, the crlf attribute would be tied to the file entry itself rather than a separate file (so changing the attribute would mean a change to the file), but I guess we are stuck with what we have.

I still think that case 2) is the most common, and fixing it has the appealing property that if the repository line endings are broken for some reason (because of case 1 or something else), then recloning or checking out from scratch is guaranteed to bring the working tree into the "correct" state.

Since fixing both cases is a pretty big task and fixing only case 2 is small, I propose that we go ahead with that.

-- Kristian Amlie

Previous: Michael J GruberNext: Kristian Amlie
Message 3 of 22 in “Honoring a checked out gitattributes file”
  1. Kristian AmlieJan 28, 2009
  2. Michael J GruberJan 28, 2009
  3. Kristian AmlieJan 28, 2009
  4. Kristian AmlieJan 30, 2009
  5. Add a test for checking whether gitattributes is honored by checkout.Kristian Amlie, Jan 30, 2009
  6. Kristian AmlieMar 12, 2009
  7. 1/2 Add a test for checking whether gitattributes is honored by checkout.Kristian Amlie, Mar 12, 2009
  8. 2/2 Make Git respect changes to .gitattributes during checkout.Kristian Amlie, Mar 12, 2009
  9. Johannes SixtMar 12, 2009
  10. Kristian AmlieMar 12, 2009
  11. Kristian AmlieMar 13, 2009
  12. 1/2 Add a test for checking whether gitattributes is honored by checkout.Kristian Amlie, Mar 13, 2009
  13. 2/2 Make Git respect changes to .gitattributes during checkout.Kristian Amlie, Mar 13, 2009
  14. Junio C HamanoMar 14, 2009
  15. Kristian AmlieMar 19, 2009
  16. Junio C HamanoMar 19, 2009
  17. Kristian AmlieMar 20, 2009
  18. Add a test for checking whether gitattributes is honored by checkout.Kristian Amlie, Mar 20, 2009
  19. Junio C HamanoMar 14, 2009
  20. Matthieu MoyMar 12, 2009
  21. Kristian AmlieMar 12, 2009
  22. Jeff KingJan 28, 2009

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.