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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- Original Message ----- From: "Junio C Hamano" <gitster@xxxxxxxxx>
Dmitry Kakurin <dmitry.kakurin@xxxxxxxxx> 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.

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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux