Thread (4 messages) flat view 4 messages, 4 authors, 2016-06-15

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

From: Dmitry Kakurin <hidden>
Date: 2016-06-15 22:43:31

----- Original Message ----- 
From: "Junio C Hamano" <redacted>
Dmitry Kakurin [off-list ref] writes:
quoted
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.
quoted
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.
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help