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

Re: .gitignore, .gitattributes, .gitmodules, .gitprecious?, .gitacls? etc.

From
DKDmitry Kakurin <dmitry.kakurin@gmail.com>
Date
Aug 26, 2007, 08:02 UTC
Message-ID
<B4A2AE9980774365B5D14B442A7A22F6@ntdev.corp.microsoft.com>
In-Reply-To
<7vhcmmpxed.fsf@gitster.siamese.dyndns.org>
----- Original Message ----- 
From: "Junio C Hamano" <gitster@pobox.com>
Show 7 quoted lines
> Dmitry Kakurin <dmitry.kakurin@gmail.com> writes:
> 
>> I thought I did: I've observed that these problem are caused by
>> storing metadata in regular files (that exist both in repo/index and
>> in workplace).
> 
> And that observation solves the initial checkout issue how?
There is always only one place to check for metadata - the index.
Show 10 quoted lines
>> My knowledge of Git internals is quite limited, but if *I* were to do
>> it right now, I'd introduce a META entry in every TREE object that
>> would point to a BLOB that contains combined content of
>> .gitattributes, .gitignore etc.
> 
> A tree that has .gitattributes (and I am assuming in the longer
> term you can use "ignore" and "precious" in .gitattributes
> instead of using .gitignore) POINTS TO A BLOB already, so what
> you are saying does not add anything to what we already have,
> other than that you are renaming .gitattributes to "META ENTRY".

Almost true! The difference is: META BLOBS are not created as files in the workspace (not during checkout, not ever). In order to edit it you'd have to use 'git meta' command. So once again, there is only one place to check for metadata - the index.

Show 5 quoted lines
> When you do "git checkout -- this-path", you are checking things
> out from the index and at that point you may not have _any_ tree
> yet (think "before initial commit").  A "META ENTRY" that exists
> only in a tree does not work -- it has to come to index somehow
> for it to work with how git works.
I don't fully understand the difficulty. Here is how I see the initial checkin to work:
Let's say you just did 'git init' and want to add file.txt with unusual crlf. So you don't want automatic translation.
What you'll do is:
* git meta
  In vi you put 'file.txt -crlf'
  git creates a TREE object in the index with only entry META that point to BLOB with this file.
  so it's kind of an empty tree from user's perspective.
* git add file.txt
  while adding the file git consults META BLOB from the TREE (stored in index) and does not do any crlf translation
  the TREE now contains 2 entries: META, and BLOB for file.txt
* git commit
   nothing special here
Now someone else doing initial checkout:
* git checkout
  Before writing file.txt to disk git consults META BLOB (in the index) and does not do any crlf translation.
- Dmitry
Previous: Junio C HamanoNext: Petr Baudis
Message 7 of 28 in “.gitignore, .gitattributes, .gitmodules, .gitprecious?, .gitacls? etc.”
  1. Dmitry KakurinAug 26, 2007
  2. Junio C HamanoAug 26, 2007
  3. Dmitry KakurinAug 26, 2007
  4. Junio C HamanoAug 26, 2007
  5. Dmitry KakurinAug 26, 2007
  6. Junio C HamanoAug 26, 2007
  7. Dmitry KakurinAug 26, 2007
  8. Petr BaudisAug 26, 2007
  9. Sam VilainAug 27, 2007
  10. David KastrupAug 27, 2007
  11. Sam VilainAug 27, 2007
  12. David KastrupAug 27, 2007
  13. Johannes SchindelinAug 27, 2007
  14. Johannes SchindelinAug 26, 2007
  15. martin f krafftAug 27, 2007
  16. Sergio CallegariAug 27, 2007
  17. David KastrupAug 27, 2007
  18. Petr BaudisAug 27, 2007
  19. Sergio CallegariAug 27, 2007
  20. Sergio CallegariAug 27, 2007
  21. Jan HudecSep 4, 2007
  22. .gitignore, .gitattributes, .gitmodules, .gitprecious?,.gitacls? etc.Dmitry Kakurin, Aug 27, 2007
  23. Jan HudecSep 4, 2007
  24. Dmitry KakurinSep 5, 2007
  25. Junio C HamanoSep 5, 2007
  26. Dmitry KakurinSep 5, 2007
  27. Jan HudecSep 5, 2007
  28. Jan HudecSep 4, 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.