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

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

 



----- Original Message -----
From: "Petr Baudis" <pasky@xxxxxxx>
> On Sun, Aug 26, 2007 at 10:02:50AM CEST, Dmitry Kakurin wrote:
>>>> 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.
>
> It's still not clear to me how this would help anything, though I didn't
> watch late Git development. Can you explain some particular scenario
> where this would improve the current situation?

Here is the problem: we need to apply crlf attributes to a file. We
could have .gitattributes both in the index and in the worktree.
Which one do we use?
In general .gitattributes file could be (U)nchanged, (C)hanged, (NP)
NotPresent in each place.
This gives us 3x3 matrix = 9 special cases to handle. When you think
about this a little more you realize that even that
is not enough and we need to take into account direction of data
movement (index -> filesystem or vice versa).
This doubles the matrix to 18 cases. Even if we come up with a very
good choice for every case (which is doubtful)
there is no way this could be *easily* explained to end user, or even memorized.
This leads to a simple idea that mostly works:
1. when files are moved from index to filesystem, then only
.gitattributes in the index is used, if it's not there == no special
attributes.
2. when files are moved from filesystem to index, then only
.gitattributes in filesystem is used, again if it's not there == no
special attributes.

Then, in any operation, only one .gitattributes is taken into account.
We could stop here, but to me this redundancy still has some room for
confusion and looks unnecessary.
Plus there is still room for unintentional abuse (by mistake).

That's why I think it's a good idea to always have only one .gitattributes.

- 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