Re: confused about preserved permissions

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

 



Mike Hommey <mh@xxxxxxxxxxxx> writes:

> On Mon, Aug 20, 2007 at 08:40:13PM +0200, David Kastrup <dak@xxxxxxx> wrote:
>> Mike Hommey <mh@xxxxxxxxxxxx> writes:
>> 
>> > On Mon, Aug 20, 2007 at 07:58:43PM +0200, David Kastrup <dak@xxxxxxx> wrote:
>> >> > I also never understood why there were no permissions set on
>> >> > directories in trees...
>> >> 
>> >> Because directories are not actually tracked.  They are created and
>> >> deleted as-needed.
>> >
>> > I don't see why it would prevent to have a permission set to
>> > it... the permission technically can be recorded in the parent tree,
>> > along its sha1. Filesystems are also like this.
>> 
>> No, they aren't.  Filesystems don't create and delete directories on
>> the fly.  If we record any information about a directory, deleting it
>> automagically would not be appropriate since we would lose information
>> that has not been explicitly deleted.
>
> git doesn't magically create directories either. It actually stores
> something about them: the hash of the tree object that represents
> them.

The tree object is not a representation of the directory in the file
system.  It is a hierarchical hash in the repository, stored for
efficiency reasons.

> And it has permissions associated with these hashes.

No, with the files.  Think again: the link between file system and
repository is the index, and the current index format has no
representation for trees or directories.

So git _can't_ store any information about a _directory_, since no
information about directories passes through the index.

> (...)
>> > I think i wasn't clear enough... I just wondered why the format for tree
>> > entries is something like (if you'd write it in perl):
>> > sprintf "%06o %s\0%s", $mode, $file, pack("H[40]", $sha1)
>> 
>> Now I am sure I don't get your point.
>
> See what a raw tree object looks like:
> git-cat-file tree 708453d64796eb617cb8a1602959e00356693315

Well, a tree is a container for files (which in turn consist of their
permissions, file names, and blobs).

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
-
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